Skip to content

Instantly share code, notes, and snippets.

@s5unty
Created July 23, 2020 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s5unty/c159ad9dd7e6f43bab5d14525988aed4 to your computer and use it in GitHub Desktop.
Save s5unty/c159ad9dd7e6f43bab5d14525988aed4 to your computer and use it in GitHub Desktop.
日志定期清理
/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