in reply to kill process when files created...

There's a real problem with your approach because tcpdump won't be running in the background.

If you just want to capture 10 packets, why not just tell tcpdump to stop after 10 packets:

tcpdump -i bge1 -c 10 > /tmp/file.out
Otherwise have a look at Net::Packet::Dump.

Replies are listed 'Best First'.
Re^2: kill process when files created...
by jethro (Monsignor) on Jul 03, 2008 at 04:47 UTC
    He wants 10 files with size 1M, not 10 packages. The parameter -C has a unit of 1,000,000 bytes.

    tcpdump seems to have no principal problem with running in the background, just checked it on the command line. It may need some io redirection if called from a script. But it should have at least a '&' at the end to go into the background.

      Good point about the -C option.

      The way the OP is invoking tcpdump it will not get run in the background. Thus the while will not get executed until tcpdump finishes.