Created
August 21, 2020 21:03
-
-
Save mattantonelli/da586f21a69f9097f2e7e79a4aabcb0e to your computer and use it in GitHub Desktop.
Bootleg log rotation for NGINX. Retains at least one month of logs before they are overwritten.
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
| cd /opt/nginx/logs | |
| mv access_old.log.gz access_older.log.gz | |
| mv access.log access_old.log | |
| kill -USR1 `cat /var/run/nginx.pid` | |
| sleep 1 | |
| gzip access_old.log |
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
| 0 0 1 * * root /opt/nginx/logs/bootleg_nginx_monthly_log_rotation.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment