Last active
August 29, 2015 14:22
-
-
Save bobuss/14b8e53140d43e76ea12 to your computer and use it in GitHub Desktop.
logrotate template
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/sh | |
# Delete log files older than {{ daysdelete }} days | |
nice -n 19 find {{ logdirectory }} -type f -name "*.bz2" -mtime +{{ daysdelete }} -exec rm '{}' \; >/dev/null 2>&1 | |
# Compress log files older than {{ dayscompress }} days | |
ionice -c3 nice -n 19 find {{ logdirectory }} -type f ! -path "*.bz2" ! -path "*.log" ! -path "*.gz" -mtime +{{ dayscompress }} -exec bzip2 '{}' \; >/dev/null 2>&1 | |
# Reload rsyslog | |
/bin/kill -HUP $(cat /var/run/rsyslogd.pid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment