我试图让logrotate为我旋转一些日志。 我觉得这应该是简单的,但似乎并不像我所期望的那样。
这是我的configuration:
/path/to/log/files/specific_file /path/to/log/files/*.filetype /path/to/log/files/*.log { daily compress missingok create 640 root root olddir /path/to/log/files/rotated rotate 5 sharedscripts postrotate ps -ef | awk '$8=="/path/to/process" {print $2}' | xargs kill service process start /run/whatever/is/here argument endscript }
我在这个目录中有几个文件是非零文件,这些文件在几天之内没有被旋转过。 如果我运行logrotate -d config_file它告诉我“日志不需要旋转”。
/var/lib/logrotate.status也只有最后一次我用-f(这是几天前)强制轮换的状态。
只是为了确保logrotate实际上甚至设置为运行我检查/etc/anacrontab和运行cron.daily的工作肯定是在那里和cron.daily有一个logrotate条目。
Anywho – IDK发生了什么事。 有人有主意吗?