ensure tcpdump actually terminates at interval
@@ -10,14 +10,20 @@ FILTER="$5"
if [ $ITERS -gt "0" ]; then
COUNTER=0
while [ $COUNTER -lt $ITERS ]; do
- tcpdump -ni $NIC -s65535 -G $INTERVAL -w 'trace_'"$ID"'_%Y-%m-%d_%H_%M_%S.pcap' -W 1 $FILTER;
+ tcpdump -ni $NIC -s65535 -w 'trace_'"$ID"'_%Y-%m-%d_%H_%M_%S.pcap' $FILTER;
+ pid=$!
+ sleep $INTERVAL
+ kill $pid
mv *.pcap /files/;
let COUNTER=COUNTER+1;
done
else # else do the capture until killed
while true
do
- tcpdump -ni $NIC -s65535 -G $INTERVAL -w 'trace_'"$ID"'_%Y-%m-%d_%H_%M_%S.pcap' -W 1 $FILTER;
+ tcpdump -ni $NIC -s65535 -w 'trace_'"$ID"'_%Y-%m-%d_%H_%M_%S.pcap' $FILTER;
+ pid=$!
+ sleep $INTERVAL
+ kill $pid
mv *.pcap /files/;
done
fi
