Advertisement
Guest User

logrotate_Script

a guest
Dec 6th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #!/bin/bash
  2. logfile=$1
  3. if [ ! -f $logfile ]; then
  4. echo "log files in $logfile not found "
  5. exit 1
  6. fi
  7.  
  8. timestamp=`date +%Y%m%d`
  9. newlogfile=$logfile.$timestamp
  10. cp $logfile $newlogfile
  11. cat /dev/null > $logfile
  12. gzip -f -9 $newlogfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement