Operating System - HP-UX
1820601 Members
1650 Online
109626 Solutions
New Discussion юеВ

Daylight Savings Time and CRON

 

Daylight Savings Time and CRON

People,

I would like to know if anyone has faced with jobs that was scheduled in time that will not exist during the transition of DST and this job was executed.
In my case, the last Sunday the DST was started in Brazil at 00:00, then we supposed that the jobs scheduled during the period 00:00 - 00:59 wouldn't be executed, but the job that was scheduled to 00:35 was ran.

I could realize the problem because other job was put to run at 01:35, and in my log file was logged that 2 processes try to execute.

Have anyone faced with the same problem?

Our Operating System is HP-UX 11.11

Thanks,
If you want something, you need to persist to get that.
5 REPLIES 5
Pete Randall
Outstanding Contributor

Re: Daylight Savings Time and CRON

You need to take a look at the man page for cron. There is a section devoted to DST transitions:

Spring and Autumn Time Transitions
On the days of daylight savings (summer) time transition (in time
zones and countries where daylight savings time applies), cron
schedules commands differently from normal.

In the following description, an ambiguous time refers to an hour and
minute that occurs twice in the same day because of a daylight savings
time transition (usually on a day during the Autumn season). A
nonexistent time refers to an hour and minute that does not occur
because of a daylight savings time transition (usually on a day during
the Spring season). DST-shift refers to the offset that is applied to
standard time to result in daylight savings time. This is normally
one hour, but can be any combination of hours and minutes up to 23
hours and 59 minutes (see tztab(4)).

When a command is specified to run at an ambiguous time, the command
is executed only once at the first occurrence of the ambiguous time.

When a command is specified to run at a nonexistent time, the command
is executed after the specified time by an amount of time equal to the
DST-shift. When such an adjustment would conflict with another time
specified to run the command, the command is run only once rather than
running the command twice at the same time.

Commands that are scheduled to run during all hours (there is a * is
in the hour field of the crontab entry) are scheduled without any adjustments.


Pete



Pete

Re: Daylight Savings Time and CRON

I've checked the cron man, but it doesn't make sense. I think because I put 2 entries in the crontab they didn't consider ambiguous.
If you want something, you need to persist to get that.
doug mielke
Respected Contributor

Re: Daylight Savings Time and CRON

Think of the cron offset as a timer. Unix looks at cron, and sees a job to run as "run this job in 3 hours"
Then, it doesn't matter that the time doesn't really exist. 3 hours later, the job will execute.
Steven E. Protter
Exalted Contributor

Re: Daylight Savings Time and CRON

I've run tests in the past and found all hourly cron jobs actually ran.

The time change effects how time is displayed. Time is actually internally kept as the number of seconds since Jan 1, 1970.

We have a time change coming up next weekend. I will schedule some cron jobs for the hour that is to be rolled back and report results.

My memory is that all of the jobs ran once and that all jobs ran.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
doug mielke
Respected Contributor

Re: Daylight Savings Time and CRON

SEP,
Some time back, we went round and round with aonther Unix flavor before we fixed all the glitches resulting from jobs running twice in the Autumn.

One of the first things I checked when starting with HP/UX was to test this, and HP is solid in this dept.