Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@alexalouit
Created October 5, 2015 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexalouit/55384766af1b4f53b683 to your computer and use it in GitHub Desktop.
Save alexalouit/55384766af1b4f53b683 to your computer and use it in GitHub Desktop.
Automatic purge compressed logs that are aged 7 days over
#!/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