Daylight Savings and Cron

空扰寡人 提交于 2019-12-03 02:03:48
mtk

The answer would be dependent on the variant/extension of cron you are using. Some variants do not handle the Daylight Saving Time, leading to missing jobs and twice run of the job.

If you are using the Paul Vixie cron, then it does handle the DST changes. As per the cron man page:

cron checks each minute to see if its spool directory's modtime (or the modtime on /etc/crontab) has changed

And further, with reference to Daylight Saving Time (The 2nd para clearly explains your answer)

Daylight Saving Time and other time changes

   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.

So, whenever the time shifts may be 2:59:59 or at 3:00:00, cron's taking care of the job runs by handling the situation and running only the missed ones and avoids running the already ran jobs.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!