linux – Logrotation – 过早发射的postrotate?

前端之家收集整理的这篇文章主要介绍了linux – Logrotation – 过早发射的postrotate?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个看起来像这样的配置文件
  1. /var/log/Nginx/*.log {
  2. daily
  3. missingok
  4. rotate 90
  5. dateext
  6. compress
  7. notifempty
  8. create 644 root adm
  9. sharedscripts
  10. postrotate
  11. [ ! -f /var/run/Nginx.pid ] || kill -USR1 `cat /var/run/Nginx.pid`
  12. /usr/local/bin/synclogs.sh
  13. endscript }

synclogs.sh应该在所有日志文件都已旋转和压缩时运行.该脚本确实成功启动,但是当它开始运行时,程序找不到logrotate应该生成的任何.gz文件.几分钟后我手动运行脚本,开始很好.

根据我发现的文档,postrotate不应该在压缩完成之前启动.那不是这样吗?这是Debian Squeeze中提供的logrotate中的错误还是我错过了一些非常简单的东西?

解决方法

你试过这个:
  1. /var/log/Nginx/*.log {
  2. daily
  3. missingok
  4. rotate 90
  5. dateext
  6. compress
  7. **delaycompress**
  8. notifempty
  9. create 644 root adm
  10. sharedscripts
  11. postrotate
  12. [ ! -f /var/run/Nginx.pid ] || kill -USR1 `cat /var/run/Nginx.pid`
  13. /usr/local/bin/synclogs.sh
  14. endscript }

看一下delaycompress选项,当然没有“*”HTH

猜你在找的Linux相关文章