【问题标题】:logrotate error file or directory not foundlogrotate 错误文件或目录未找到
【发布时间】:2017-09-18 01:27:18
【问题描述】:

我有一个 logrotate 配置文件:

/myapps/log.log {
  missingok
  notifempty
  rotate 9
  copy
}

然后当我运行 /usr/sbin/logrotate -d -f logrotate.conf

报错:

renaming /myapps/log.log.2 to /myapps/log.log.3 (rotatecount 2, logstart 1, i 2)
renaming /myapps/log.log.1 to /myapps/log.log.2 (rotatecount 2, logstart 1, i 1)
renaming /myapps/log.log.0 to /myapps/log.log.1 (rotatecount 2, logstart 1, i 0)
copying /myapps/log.log to /myapps/log.log.1
Not truncating /myapps/log.log.3
error: error opening /myapps/log.log.3: No such file or directory

我还没有 log.log.3,所以它不存在,但正因为如此,logrotate 根本不起作用,我该如何修复它。

【问题讨论】:

    标签: logrotate


    【解决方案1】:

    在我自己遇到这个之后,我了解到-d 标志将在调试模式下运行 logrotate,除了抛出该错误之外它实际上不会做任何事情。试试不要在调试模式下运行它,我猜它可以解决你的问题。

    https://github.com/logrotate/logrotate/issues/165

    【讨论】:

      猜你喜欢
      • 2021-12-19
      • 1970-01-01
      • 2021-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-27
      • 1970-01-01
      相关资源
      最近更新 更多