cron
cron copied to clipboard
The leap second caused a scheduled job to run twice
I have a job that is scheduled to run at 0 0 1 * *
, i.e. at midnight at the beginning of each month. This worked as expected until this past January 1, when the job ran twice. PostgreSQL reports that the task ran at the following times:
- 2016-12-31 23:59:59.070603+00
- 2017-01-01 00:00:00.006794+00
For comparison, the most recent normal run happened at 2016-12-01 00:00:00.006968+00.
I assume that the culprit was the leap second that was inserted at the end of 2016-12-31: there was a 23:59:60 on that day.
This happened under Ubuntu 14.04.5. The machine uses NTP (with, I believe, whatever the default Ubuntu configuration is) to keep its time in sync.
At least for chrony this behavior is actually configurable - see https://chrony.tuxfamily.org/doc/2.4/chrony.conf.html#leapsecmode
Is chrony related to this cron library somehow, or are you just pointing out a possible future feature? 🙂
Not really - I'm just trying to point out that the behavior of step seconds is configurable in NTP daemon. Chronyd is just a replacement for NTPD which I'm very happy with for a long time.
BTW there's no chance I'm going to work on this bug fix any time soon but I'd be happy to take a PR.