On Jul 1, 9:02 pm, [EMAIL PROTECTED] (Jenda Krynicky) wrote: > To: [EMAIL PROTECTED] > From: onlineviewer <[EMAIL PROTECTED]> > Subject: kill process when file number reached... > Date sent: Tue, 1 Jul 2008 11:26:42 -0700 (PDT) > Organization: http://groups.google.com > > > Hello All, > > > I am trying to run a tcpdump and have perl kill the tcpdump once 10 > > files have been created by the tcpdump. Here is my code, not sure...if > > my logic is screwy > > Thanks, > > > system "tcpdump -i bge1 -s0 -w /tmp/file.out -C 1"; > > sleep 2; > > The system() doesn't return until the tcpdump exits. > > You probably want to fork() and exec() instead. Or use > > system 1, "tcpdump -i bge1 -s0 -w /tmp/file.out -C 1"; > > "system(1, @args) spawns an external process and immediately returns > its process designator, without waiting for it to terminate. Return > value may be used subsequently in wait or waitpid. Failure to spawn() > a subprocess is indicated by setting $? to "255 << 8". $? is set in a > way compatible with Unix (i.e. the exitstatus of the subprocess is > obtained by "$? >> 8", as described in the documentation). " > > HTH, Jenda > ===== [EMAIL PROTECTED] ===http://Jenda.Krynicky.cz===== > When it comes to wine, women and song, wizards are allowed > to get drunk and croon as much as they like. > -- Terry Pratchett in Sourcery
thanks, for the info, although im not really sure how to implement this into my code. can you show me how that would be inserted ? Thanks again, -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/