Topic Options
#72 - 01/17/01 05:20 PM How to ensure that an event is not fired more than expected
Anonymous
Unregistered


consider this script

# Daily event, never expires
{
-start -time 03:00:00 AM
-command Defrag /s /f
-action -inc 1 0 0 0
-action -print Running defrag now
}

The scripts runs fine at 03:00:00 AM, but an hour later the server has to be rebooted. When WinCron is restarted with this job, it immediately runs it. Meaning that this job has been run twice on the same day!
Is there any way around this ?

thanks,
Peter

Top
#73 - 01/17/01 07:24 PM Re: How to ensure that an event is not fired more than expected
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Ah, this is an easy one.
Whenever WinCron starts, it checks to see if a job is past due.
In your case, it is in fact, past due and must run it. (WinCron has no way to know it has already run this job before the reboot.)

The solution is to constrain the window of execution to within a set amount of time.

To do this, we simply add a constrain directive and specify a 5 minute window.
Therefore, when the system reboots at 4AM, this will fall outside the 3AM + 5 minute grace period and will not fire.

# Daily event, never expires
{
-start -time 03:00:00 AM -constrain 0 0 5 0
-command Defrag /s /f
-action -inc 1 0 0 0
-action -print Running defrag now
}
_________________________
Regards,
Luke Tomasello

Top


Moderator:  Luke Tomasello