Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/ksh
- # Author : bonstechblog
- # www bonstechblog.wordpress.com
- #
- # Filename : rotateSnoop
- # Description : This script runs a snoop trace and outputs a new file
- # every 130000 packets. It also keeps check of the number
- # of output files and deletes the oldest once over that
- # number.
- #
- #
- # Created :
- # VER DATE ORIGINATOR DESCRIPTION
- # 1.0 23/01/2013 bonstechblog First version
- while :;
- do
- nice snoop -d e1000g1 -c 210000 -o /opt/`hostname`Snoop_`date +%Y%m%d%H%M%S`.cap udp > /dev/null 2>&1
- fileCount=$( ls -al /opt/`hostname`Snoop*|/bin/wc -l )
- if [ $fileCount -gt 50 ]
- then
- rm $( ls -alt /opt/`hostname`Snoop*|tail -1|awk '{print$NF}' )
- fi
- done
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement