具体操作:
1.创建文件/etc/logrotate.d/nginx
2.文件中添加以下内容:
/app/nginx/logs/*.log { daily dateext missingok rotate 60 compress notifempty create 640 nginx adm sharedscripts postrotate if [ -f /app/nginx/logs/nginx.pid ]; then kill -USR1 `cat /app/nginx/logs/nginx.pid` fi endscript } |
3.验证是否执行
# grep logrotate/var/log/cron