Last weekend we had to change the time from 02:00 to 03:00.
Question: What would happen if there was a cronjob at 02:30?
crond is a very old solution for scheduling, it should probably handle it, but don't know how.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
It probably depends on your cron implemenation, but the popular Vixie cron states in the manual:
cron then wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute.
Special considerations exist when the clock is changed by less than 3 hours, for example at the beginning and end of daylight savings time. If the time has moved forwards, those jobs which would have run in the time that was skipped will be run soon after the change. Conversely, if the time has moved backwards by less than 3 hours, those jobs that fall into the repeated time will not be re-run.
Only jobs that run at a particular time (not specified as @hourly, nor with '*' in the hour or minute specifier) are affected. Jobs which are specified with wildcards are run based on the new time immediately.
Since the DST change was less than 3 hours, your program would run shortly after 3:00 AM
I am not sure if this is Vixie cron specific behaviour, I seem to recall this is how my PDP-11 worked as well back in the 80s but I am not sure.
The best solution is to have your computer running with the hardware clock set to UTC, (Coordinated Universal Time), AKA GMT or Zulu Time and only change the way that the time is displayed by setting the local time zone to allow the Day Light Saving time to take over.
On SUSE Linux, and probably most others, if the Hardware Clock System -> Environment -> Clock -> HWCLOCK is set to UTC with the -u flag then and your time zone is set to where you are the system will automatically display local times with DST corrections for you.
This has a number of advantages:
For more information type
man hwclock in a terminal.