eval { local $SIG{ALRM} = sub { die "tcpdump Died\n" }; alarm 20; @captured_data = `$tcpdump -i $nic -c1 -xx -s0 'ether[20:2] == + 0x2000' 2>/dev/null`; alarm 0; }; # Check the status of eval to see if we alarmed out if ($@) { return; } else { return @captured_data; }; }; After the script runs: grapeape:~# ps -ef |grep tcpdump |grep -v grep root 3499 1 1 16:26 pts/1 00:00:00 sh -c /usr/sbin/tcpdum +p -i eth0 -c1 -xx -s0 'ether[20:2] == 0x2000' 2>/dev/null root 3500 3499 2 16:26 pts/1 00:00:00 /usr/sbin/tcpdump -i e +th0 -c1 -xx -s0 ether[20:2] == 0x2000
In reply to Eval leaving zombies when dying with alarm by yogsothoth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |