Last active
March 1, 2021 07:49
-
-
Save roens/da0a4f7196fff1d8fafa8a688a39f1bb to your computer and use it in GitHub Desktop.
Since `supervisord` [lacks an option for compression of rotated log files](https://github.com/Supervisor/supervisor/issues/322), I wrote this script. It works well to live in `/etc/cron.daily`.
This file contains hidden or 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
#!/usr/bin/env bash | |
# supervisor-log-compress.sh | |
# | |
# supervisord writes logs, and rotates them, but does not compress old log | |
# files. This script is meant to help with that cleanup, reclaiming storage. | |
# | |
# A nice place for this script is in: /etc/cron.daily/ | |
for f in /var/log/supervisor/*.log.*; do | |
if [ ! "${f##*.}" == 'gz' ]; then # Exclude already compressed files | |
gzip "${f}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment