[Solved] Terminate TCPDUMP in a certain time period

Hello All,

As I stated in subject, I need a command to terminate my tcpdump command in a certain time period. (using HP-UX)

I am using below one to terminate when number of captured packages reach 3 limit.
But what if there will no packet come in 5 min for instance?
Please help me to find a way.

Thank you!

tcpdump -w packet.pcap -s 4096 -c 3 host $IP

Try:

tcpdump -w packet.pcap -s 4096 -c 3 host $IP &
sleep 300; kill $!

Hi Bartus,

Simlpy works, thanks for your very good idea!