0

I have windows 2008 server R2. I am using Task scheduler to run a job on a daylight saving time when the clock moves backward.

The task runs a PHP script that updates the a database field (If field is equal to 1 then change it to 0 if the field is equal to 0 then change it to one). This is used as an on and off switch.

The aim of the task is to run at 1:59:59 to turn the switch on. The the clock will go back to 1:00:00 then when it reaches 1:59:59 again it should turns the switch off.

At the moment the Task fails to run when the clock turns 1:59:59 for first time but runs when the clock reach 1:59:59 the second time. Why does it ignore the first hour and runs on the second one?

Is there a way for the task to run twice on daylight saving time?

I hope my question makes sense. Thanks for reading.

1 Answers1

0

Let me start by saying that I'm not to familiar with Windows Server 2008 internals.

But when a task only runs once when scheduled to run at 01:59 on the day daylight saving time (DST) ends I expect that your scheduler (internally) converts a timestamp to UTC when you set it. Doing such a conversion would prevent a job from running twice (or otherwise failing to run) when the local time offset to UTC gets changed.

It might be interesting to see if after the DST switch your daily job is no longer scheduled for 01:59 but will from then on run at either 00:59 or 02:59 in localtime instead.

If that is the case there might be an option te force the scheduler to use localtime rather than UTC...

This Q&A might be interesting.

HBruijn
  • 72,524
  • 21
  • 127
  • 192