Simple Shell Script TCPDUMP Output Stores in a Log File.
Tcpdump is getting to traffic on a network, refer tcpdump from the link :
The current developments version of tcpdump and libpcap is free from the GitHub, You can clone the tcpdump GitHub repository using
git clone https://github.com/the-tcpdump-group/tcpdump.git
git clone https://github.com/the-tcpdump-group/libpcap.git
You can then configure and compile the source via the normal GNU autoconf method.
The simple shell script do take a backup current tcpdump logs every 10 minutes into a tcpdump.log in your home directory
/usr/sbin/tcpdump -i eth0 ip >> ~/tcpdump.log &
pkill -9 tcpdump
If you would like to set the cron job every 10 minutes,
Open a crontab file
# vim /etc/cron/crontab
0,10,20,30,40,50 * * * * /bin/sh /root/check_tcpdump.sh
You might restart the cron service.