Created
July 23, 2020 09:12
-
-
Save s5unty/c159ad9dd7e6f43bab5d14525988aed4 to your computer and use it in GitHub Desktop.
日志定期清理
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
/home/scm/.logrotate.dummy { | |
daily | |
su scm scm | |
rotate 0 | |
create | |
ifempty | |
lastaction | |
cd /home/scm/instance/ | |
/usr/bin/find . -path "*/logs/*old*" -type f -mtime +90 -delete | |
/usr/bin/find . -path "*/logs/*log*" -type f -mtime +90 -delete | |
/usr/bin/find . -path "*/logs/*log*" -type f -mtime +1 -exec gzip -q {} \; | |
/usr/bin/find . -path "*/logs/*old*" -type f -mtime +1 -exec gzip -q -S ".$(date +%Y-%m-%d).gz" {} \; | |
endscript | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment