Advertisement
bonstechblog

rotateSnoop

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