传统运维 - logrotate

2022-04-12
/var/log/nginx/*.log {
        su root root
        daily
        missingok
        rotate 30
        compress
        dateext
        compress
        notifempty
        create 640 root root
        sharedscripts
        postrotate
                if [ -f /var/run/nginx.pid ]; then
                        kill -USR1 `cat /var/run/nginx.pid`
                fi
        endscript
}