Created
November 19, 2011 04:11
-
-
Save reyjrar/1378430 to your computer and use it in GitHub Desktop.
Manage /var/log/remote/ syslog storage, compressing and pruning older files.
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 | |
# | |
# Script to manage syslog storage capacity | |
# Remove anything older than 1 year | |
find /var/log/remote/ -mindepth 2 -mtime +365 -type f -exec rm '{}' \; | |
# Remove empty directories | |
find /var/log/remote/ -type d -empty -exec rmdir '{}' \; | |
# Compress anything with an modify time > 7 days, exclude .gz files | |
find /var/log/remote/ -mindepth 2 -mtime +7 -type f ! -name \*.gz -exec gzip '{}' \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Y U NO USE logrotate?