我需要在系统启动时进行logrotate。我为logrotate创建了一个自定义配置以压缩文件。 @reboot的解决方案不起作用。
在根目录中,我有类似这样的内容:
@reboot --force /etc/logrotate.conf
但是它不起作用。我正在研究Debian 10。
我假设您说的是'crontable',意思是crontab,在这种情况下,您的格式不正确。根据crontab手册页(1):
These special time specification "nicknames" are supported,
which replace the 5 initial time and date fields, and are prefixed by the '@' character:
@reboot : Run once after reboot.
@reboot
昵称仅替换5个时间/日期字段;您仍然需要遵循有关如何在crontab中格式化命令的规则(再次从手册页中进行格式化):
<date fields> <user to run command as> <command to run>
例如,
30 12 * 8 * root touch /tmp/file
因此,如果您想使用@reboot
昵称,则只需替换字符串开头的五个时间/日期字段,例如
@reboot root touch /tmp/file