I want to schedule 4 task on windows task schedular.
The conditions are
1. Task 1 should run every 30 mins;
2. Task 2 should run every 1 hour;
3. Task 3 should run every 2 hours;
4. Task 4 should run every 3 hours;
5. None of the 2 task should run at the same time;
6. If error comes in any task it should run again next time;
7. Also, I don't want to maintain any file regarding it.
Thanks in advance.
Additional Details:
Note: For each day we have millions of records.
So completing of each task varies from 30 mins to around 1 hour.
Task 1: Gets data for 0-7 Days, updates it and then saves back to the sql server.
Similarly task 2,3, and 4 does it for 0-14,0-21 and 0-31 days.
Now the problem is with the server that it is single login, i.e if task 2 logins then task 1 is logged out. I don't have any control on the sql server (3rd party).
So a sample of how the task should run is like this
00:00 Task 1 Starts
00:20 Task 1 Completes
00:30 Task 1 Starts
01:00 Task 2 Waiting to start
01:05 Task 1 Completes
01:05 Task 2 Starts
01:30 Task 1 Waiting to start
01:45 Task 2 Completes
01:45 Task 1 Starts
02:00 Task 3 Waiting to start
02:10 Task 1 Completes
02:10 Task 3 Starts
02:30 Task 1 Waiting to start
03:00 Task 4 Waiting to start (Since task 4 already contains task 1, so the waiting task 1 should call off itself)
03:05 Task 3 Completes
03:05 Task 4 Starts
and so on...
schtasks /query /TN \Microsoft\Windows\Wininet\CacheTask
Where "/TN" is the task name and the line following is the location of the task. This will tell you if something's running, if you can parse the output in a script and then have the script wait until "status" changes from "Running" to "Ready" then you could go from there.
– Alex Berry Aug 04 '14 at 15:36