logrotate
程序员文章站
2022-03-20 14:05:46
...
1.定时任务
0 0 * * * /bin/bash -x /usr/local/sbin/logrotate-nginx.sh > /dev/null 2>&1
2.配置片段
/data/logs/nginx/*.log
{
compress
daily
copytruncate
create 0664 uniondrug uniondrug
ifempty
dateext
olddir /backlog
rotate 180
postrotate
if [ -f /var/run/nginx.pid ]; then
kill -USR1 `cat /var/run/nginx.pid`
fi
endscript
}
2.d