/home/deployuser/deploy/nginx/temp/logs/home.access.log { size 100M rotate 100 nocompress daily missingok notifempty sharedscripts postrotate [ ! -f /home/deployuser/deploy/nginx/temp/logs/nginx.pid ] || kill -USR1 `cat /home/deployuser/deploy/nginx/temp/logs/nginx.pid` endscript }
保存在/etc/logrotate.d/home中,而logrotate是cronjob每天跑的任务。
postrotate部分是rotate之后通知nginx重新打开日志文件以免丢失日志。