On Fri, Dec 22, 2000 at 03:46:57PM -0600, Neulinger, Nathan R. wrote:
> Should be simple enough to write a small perl script that you can run out of
> cron to trigger tethereal that does similar to below, but slightly cleaner:
>
> just do something like:
>
> if ( $childpid = fork )
> {
> system("run tethereal cmd you want");
> exit;
> }
> sleep(6*60*60); # 6 hours
> kill 9, $childpid;
(I'm assuming here that "kill" in Perl takes the signal number as an
argument.)
"kill 2" (or, if "kill" takes a signal *name* as an argument, the name
of SIGINT) - or "kill 15" (SIGTERM) or "kill 1" (SIGHUP) might be
preferable, as per my earlier mail; "kill 9" just sends a SIGKILL, which
kills Tethereal even if it's only written part of a packet record to the
output file, but Tethereal catches SIGINT, SIGTERM, and SIGHUP - if it
gets one of those signals, it cleans up, closing the capture device
(which, on Linux 2.0[.x] kernels, makes it less likely that the device
will be left in promiscuous mode; Linux 2.2 and later, and other
UNIX-flavored OSes, will clean up automatically), and closing the
capture file cleanly so that any buffered-and-not-yet-written stuff is
written out to the file.