DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"
Cron 标签行:
38 13 15-21 * 2 /usr/bin/wall "3rd Tuesday of the month?"
因此,我期望墙上程序会向每个登录用户写入消息并告知他们。我希望这种情况每月的第三个星期二发生。
根据 cron.guru 的解释是:每月 15 日至 21 日以及星期二的 13:38。
那么为什么它会在 2020 年 10 月 6 日运行呢?似乎星期几的过滤器不起作用,因为今天是本月的 6 号,过滤器应该只传递 15 号到 21 号。这对其他人有用吗?这是一个错误吗?应该在哪里报告?
答案1
这是有记录的行为。具体来说,来自man 5 crontab
:
Note: The day of a command's execution can be specified by two fields — day of month, and day of week. If both fields are restricted (i.e., aren't *), the command will be run when either field matches the cur‐ rent time. For example, ``30 4 1,15 * 5'' would cause a command to be run at 4:30 am on the 1st and 15th of each month, plus every Friday. One can, however, achieve the desired result by adding a test to the command (see the last exam‐ ple in EXAMPLE CRON FILE below).