【发布时间】:2019-10-28 19:59:17
【问题描述】:
我需要在系统启动时登录。我为 logrotate 创建了一个自定义配置来压缩文件。 @reboot 的解决方案不起作用。
在根 crontable 我有这样的东西:
@reboot --force /etc/logrotate.conf
但它不起作用。我正在开发 Debian 10。
【问题讨论】:
我需要在系统启动时登录。我为 logrotate 创建了一个自定义配置来压缩文件。 @reboot 的解决方案不起作用。
在根 crontable 我有这样的东西:
@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
【讨论】: