答案将取决于您使用的 cron 的变体/扩展。某些变体不处理夏令时,导致作业丢失和作业运行两次。
如果您使用的是 Paul Vixie cron,那么它会处理 DST 更改。根据cron 手册页:
cron 每分钟检查一次它的假脱机目录的 modtime(或 /etc/crontab 上的 modtime)是否已更改
此外,参考夏令时(第 2 段清楚地解释了你的答案)
夏令时和其他时间变化
Local time changes of less than three hours, such as those caused by
the start or end of Daylight Saving Time, are handled specially. This
only applies to jobs that run at a specific time and jobs that are run
with a granularity greater than one hour. Jobs that run more fre-
quently are scheduled normally.
If time has moved forward, those jobs that would have run in the inter-
val that has been skipped will be run immediately. Conversely, if time
has moved backward, care is taken to avoid running jobs twice.
Time changes of more than 3 hours are considered to be corrections to
the clock or timezone, and the new time is used immediately.
因此,每当时间转移可能是 2:59:59 或 3:00:00 时,cron 会通过处理情况并仅运行错过的作业来处理作业,并避免运行已经运行的作业。