logrotate自动切割某一服务模板

切割的前提是服务的脚本放在/var/log下面,而且以.log结尾

FW=nginx
A=daily
B=weekly
C=yearly

/var/log/$FW/*.log {
        $A
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 $FW adm
        sharedscripts
        postrotate
                if [ -f /var/run/$FW.pid ]; then
                        kill -USR1 `cat /var/run/$FW.pid`
                fi
        endscript
}

原文地址:https://www.cnblogs.com/syy1757528181/p/12898964.html