将以下代码保存至 /etc/logrotate.d/ 目录下,请注意自行替换相关参数。
/usr/local/nginx/logs/*.log {
weekly
missingok
rotate 4
compress
delaycompress
notifempty
create 0640 www-data
sharedscripts
postrotate
test ! -f /usr/local/nginx/logs/nginx.pid || kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
endscript
0 条评论