Win Server 2008: Task Scheduler runs programs twice or late
Posted
by SomeName
on Server Fault
See other posts from Server Fault
or by SomeName
Published on 2010-05-05T13:06:58Z
Indexed on
2010/05/05
13:18 UTC
Read the original article
Hit count: 255
task-scheduler
|windows-server-2008
Hi,
I need to restart a service every day. I have logon hours restricted at 3:00 am, and the server will logout existing TS connections.
I have two tasks scheduled:
- "Daily At 3:20 am every day" "start a program" "c:\windows\system32\sc.exe stop myservice"
- "Daily At 3:22 am every day" "start a program" "c:\windows\system32\sc.exe start myservice"
I came in today to notice that the service wasn't running. I've been digging in logs, and found these entries:
For stop task, history:
a) 3:29:35 am: Action Completed (sc result code 0)
b) 3:20:00 am: Action Completed (sc result code 0)
For start task, history:
a) 3:29:35 am: Action Completed (sc result code ERROR_SERVICE_ALREADY_RUNNING 1056 (0x420))
b) 3:22:01 am: Action Completed (sc result code 0)
Checking event logs shows me:
a) 3:29:35 am, Application log, Source myservice, "The service was stopped"
b) 3:29:25 am, System log, Source Service Control Manager, "The myservice service entered the stopped state"
So,
- What would have caused both tasks to run at 3:29 am?
- Why don't I see a message from the SCM saying that the service entered the running state?
- Is this the preferred way to do this?
Thanks!
© Server Fault or respective owner