Shell script to delete logs older than 7 days – daily
Script in cron to delete logs daiily older then 7 days ( excludding current day )
serverunix# crontab -l | grep /scripts/cleanup-dailys
5 6 * * 1-5 /scripts/cleanup-dailys > /dev/null 2>&1
serverunix#cat cleanup-dailys
find /data/logs/dailys -type f -mtime +6 -exec ls -l {} \; | tee -a $LOGFILE
find /data/logs/dailys -type f -mtime +6 -exec /usr/contrib/bin/gzip {} \;
find /data/logs/dailys -type f -mtime +6 -exec rm -rf {} \;
Category: Shell Scripting
