I am looking for a reliable solution to do package capture for test automation.
Right now, tcpdump has been used with the following command.
sudo tcpdump -i ens160 -w filename.pcap -G 60 -W 1
I stop tcpdump with:
kill -s SIGINT <pid>
1 out of 20 time tcpdump fails to exit properly, and the pcap file will be damaged.
Is there any way to make sure tcpdump will exit properly?