配置logrotate状态文件

Raj*_*Raj 3 linux redhat logrotate

我正在尝试使用logrotate旋转日志文件。但是,我们不想以root身份进行操作。但是,如果我用其他工作帐户执行它,则由于无法编辑或创建文件/var/lib/logrotate.status而失败。有没有一种方法可以配置日志轮换以使用其他状态文件。

小智 5

您是否尝试过使用“ -s”参数?从手册:

   -s, --state <statefile>
          Tells logrotate to use an alternate state file.  This is  useful
          if  logrotate  is being run as a different user for various sets
          of log files.  The default state file is /var/lib/logrotate/sta-
          tus.
Run Code Online (Sandbox Code Playgroud)