Last active
August 29, 2015 14:17
-
-
Save brandocorp/3ef5293f6e738a0dcf0a to your computer and use it in GitHub Desktop.
supervisor log cleanup
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 | |
# remove emtpy clutter | |
find /var/log/supervisor/ -size 0 -exec rm -f {} \; | |
##### Rotated Logs ##### | |
# gzip any rollovers | |
find /var/log/supervisor/ -regex '.*supervisor-[A-Za-z0-9]+.log.[0-9]+' -exec gzip -f {} \; | |
# remove anything older than 3 days | |
find /var/log/supervisor/ -regex '.*supervisor-[A-Za-z0-9]+.log.*' -mtime +2 -exec rm -f {} \; | |
##### Main Logs ##### | |
# gzip older than a day, this shouldn't be occuring very often | |
find /var/log/supervisor/ -regex '.*supervisor-[A-Za-z0-9]+.log' -mtime +1 -exec gzip -f {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment