From: onlineviewer <[EMAIL PROTECTED]>
> On Jul 1, 9:02 pm, [EMAIL PROTECTED] (Jenda Krynicky) wrote:
> > From: onlineviewer <[EMAIL PROTECTED]>
> > > 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). "
> 
> 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 ?


Change 
  system "tcpdump -i bge1 -s0 -w /tmp/file.out -C 1";
to
  system 1, "tcpdump -i bge1 -s0 -w /tmp/file.out -C 1";

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


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to