Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How to schedule a task X minutes after Windows Server 2003 starts?

In "Scheduled Tasks" one can specify "When my computer starts" but I see no way to specify delay.

What I am trying to achieve: there is a service (JIRA) that even though dependent on SQL Server service still doesn't wait long enough for SQL Server to become fully operational. So JIRA service fails to connect to the database and needs to be restarted manually after each server reboot. My plan is to add "SC stop" and "SC start" commands for JIRA service 3 minutes after server starts.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

In your batch file with the sc.exe command just wait for x minutes before running sc.exe.

I don't remember if 2003 has something native for this, but there is always 'sleep.exe' in the Windows Server 2003 Resource Kit:

sleep.exe 180
sc.exe start...

waits for 3 minutes

share|improve this answer
1  
The native utility is timeout. –  jscott Jun 2 '12 at 20:56

In Powershell one can use this to sleep 10 seconds:

Start-Sleep -s 10

share|improve this answer
1  
I would not use Powershell in this case, it loads the dot.Net runtime which is a lot of overhead just for waiting a little bit. –  Peter Hahndorf Jun 2 '12 at 21:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.