"Gabriela" <> screv in
news:81123fbd-4aa5-4e7d-b849-...
> Hi
> I have a vbs file that crawls some webpages on the web.
> It takes the vbs ~10hours to complete the run, and works just fine.
> I want it to run daily every 2 hours.
> I setup a scheduled task, that run daily, every 2 hours, and receives
> param1 as input:
> "wscript.exe MyScript.vbs param1"
> -> My script ran only ONCE a day. I presume that this is probably
> because scheduled task cannot instantiate a new vbs instance, while
> the task's script is still running. True?
> If so, than I setup 12 scheduled tasks - starting at 00:00, 02:00,
> 04:00, ...22:00 - under the assumption that since it takes ~10hours to
> run, next scheduled task will be without 24 hours, and won't collide.
> Now the vbs scripts are instantiated correctly every 2 hours BUT - a
> weird thing is happening - it seems like all scripts currently running
> finish at the exact same second, and are fully synchronized. They are
> all at the same line of code, even though they began 2 hours later.
> It's like they're waiting for each other to be synced, and start
> together, and finish together.
> What's up with that?
> Thanks,
> Gabi.
I would start by adding some simple diagnostics to each script, e.g. like
so:
- Instead of using a single script, use 12 of them, each starting with this
statement:
const sVersion = "Script02" (or "Script 04") etc.
- Each time a script starts, get it to add a log line to its own log file
c:\Script02.log. Make it something like
oLogFile.writeline "Script started", now()
- Do the same when the script ends.
When you examine the log files then you will know exactly when each script
started and ended. Two more points:
- AFAIK you can run several instances of cscript.exe at the same time.
- Rather than running 12 tasks, run a single task and repeat it once every
two hours. Remember to make its duration 24 hours! (This is for the
production run, not for the above test).
- You shoul also examine the Task Scheduler log file. What does it report?
|