Nginx 为什么logrotate什么都不做,只抱怨没有错误?

Nginx 为什么logrotate什么都不做,只抱怨没有错误?,nginx,logrotate,Nginx,Logrotate,答案可能对您来说很明显,但我开始运行我的第一个logrotate实例。 /etc/logrotate.d中的配置 /mnt/nginx/logs/access.log { size 1k dateext missingok rotate 10 compress delaycompress notifempty create 640 root root

答案可能对您来说很明显,但我开始运行我的第一个logrotate实例。 /etc/logrotate.d中的配置

    /mnt/nginx/logs/access.log {
        size 1k
        dateext
        missingok
        rotate 10
        compress
        delaycompress
        notifempty
        create 640 root root 
        sharedscripts
        postrotate
                [ -f /opt/nginx/logs/nginx.pid ] && kill -USR1 `cat /opt/nginx/logs/nginx.pid`
        endscript
}
然后我测试了它

sudo /usr/sbin/logrotate -dvf /etc/logrotate.d/nginx
并且得到了关注 正在读取配置文件/etc/logrotate.d/nginx 正在读取/mnt/nginx/logs/access.log的配置信息

Handling 1 logs

rotating pattern: /mnt/nginx/logs/access.log  forced from command line (10 rotations)
empty log files are not rotated, old logs are removed
considering log /mnt/nginx/logs/access.log
  log needs rotating
rotating log /mnt/nginx/logs/access.log, log->rotateCount is 10
dateext suffix '-20140724'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding logs to compress failed
glob finding old rotated logs failed
renaming /mnt/nginx/logs/access.log to /mnt/nginx/logs/access.log-20140724
creating new /mnt/nginx/logs/access.log mode = 0640 uid = 0 gid = 0
running postrotate script
running script with arg /mnt/nginx/logs/access.log : "
                [ -f /opt/nginx/logs/nginx.pid ] && kill -USR1 `cat /opt/nginx/logs/nginx.pid`
"


Before test
total 84K
-rw-r--r-- 1 root root 51K Jul 22 15:05 access.log
-rw-r--r-- 1 root root 24K Jul 15 17:02 error.log


After test
total 84K
-rw-r--r-- 1 root root 51K Jul 22 15:05 access.log
-rw-r--r-- 1 root root 24K Jul 15 17:02 error.log
完全没有什么变化。它也没有抱怨错误。 你能帮个忙吗

谢谢我犯了个错误。
-不应使用d选项。
但既然它是这样运行的,为什么不称之为“干”运行呢?

我犯了一个错误。
-不应使用d选项。
但既然它是这样运行的,为什么不称之为“干”运行呢?

我犯了一个错误。
-不应使用d选项。
但既然它是这样运行的,为什么不称之为“干”运行呢?

我犯了一个错误。
-不应使用d选项。
但既然它是这样运行的,为什么不称之为“干”运行呢