标签:log etc .com not 执行 main dai 错误 work
tee /etc/logrotate.d/nginx <<-EOF
/data/wwwlogs/*main.log {
daily
rotate 5
missingok
dateext
compress
notifempty
sharedscripts
postrotate
[ -e /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid`
endscript
}
EOF
tee /etc/logrotate.d/mymon <<-EOF
/home/work/gopath/src/github.com/open-falcon/mymon/mymon.log {
daily
rotate 5
missingok
dateext
compress
notifempty
sharedscripts
postrotate
endscript
}
EOF
logrotate -d /etc/logrotate.d/mymon #测试
logrotate -vf /etc/logrotate.d/mymon #强制执行
daily #每日执行,weekly,yearly
rotate 5 #保存几份
missingok #忽略logrotate执行时的错误
dateext #日期方式命令保存的文件
compress #压缩
notifempty #检查日志文件是否为空,空不执行
sharedscripts
postrotate #其他命令
标签:log etc .com not 执行 main dai 错误 work
原文地址:https://www.cnblogs.com/ops-sylar/p/9627724.html