根据crontab.guru,@reboot、@daily、@ annually等许多功能都不是标准的。有没有办法知道在我的系统(Kubuntu 21.04)上实现的那个?我试过手册页,但没有结果。
谢谢
支持的时间规范的“特殊字符串”列在man 5 crontab:
Run Code Online (Sandbox Code Playgroud)Instead of the first five fields, one of eight special strings may ap? pear: string meaning ------ ------- @reboot Run once, at startup. @yearly Run once a year, "0 0 1 1 *". @annually (same as @yearly) @monthly Run once a month, "0 0 1 * *". @weekly Run once a week, "0 0 * * 0". @daily Run once a day, "0 0 * * *". @midnight (same as @daily) @hourly Run once an hour, "0 * * * *". Please note that startup, as far as @reboot is concerned, is the time when the cron(8) daemon startup. In particular, it may be before some system daemons, or other facilities, were startup. This is due to the boot order sequence of the machine.
如果您不相信系统文档,那么您可以下载源代码(例如apt-get source cron)并检查entry.c文件:
cron-3.0pl1$ grep '!strcmp' entry.c
if (!strcmp("reboot", cmd)) {
} else if (!strcmp("yearly", cmd) || !strcmp("annually", cmd)){
} else if (!strcmp("monthly", cmd)) {
} else if (!strcmp("weekly", cmd)) {
} else if (!strcmp("daily", cmd) || !strcmp("midnight", cmd)) {
} else if (!strcmp("hourly", cmd)) {
Run Code Online (Sandbox Code Playgroud)