Created
October 5, 2015 14:28
-
-
Save alexalouit/55384766af1b4f53b683 to your computer and use it in GitHub Desktop.
Automatic purge compressed logs that are aged 7 days over
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# cron ex: 25 5 * * * /usr/bin/nice -n 19 /usr/bin/ionice -c2 -n7 /root/scripts/gzed-log-purge.sh >> /root/scripts/cron.log | |
# Search files more than 14 days with .gz extension and remove it | |
find /var/log -type f -ctime +7 -regex ".*\.gz$" -delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment