Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: vbs scheduled task behaving very weird

Reply
Thread Tools Display Modes

Re: vbs scheduled task behaving very weird

 
 
Pegasus [MVP]
Guest
Posts: n/a

 
      12-13-2009



"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?

 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a

 
      12-14-2009
You can see the Task Scheduler log file in the Control Panel / Task
Scheduler under the Advanced pull-down menu.

Your problem is not that the script fails to re-instantiate itself when it
is already running. It is that the Task Scheduler won't relaunch a task that
is still active. If you do want your tasks to run concurrently the you must
create separate tasks for them.

Since different operating systems have different Task Schedulers, it would
help if you stated your server version.

"Gabriela" <> screv in
news:720ea82c-5e82-4afd-8e3d-...
> Hi Pegasus,
> Thanks for the tips.
> I really wanted to avoid multiplying the script 12 times, as you
> suggested. But if there's no other way - I'll do it.
> I did start with having a single scheduled task, running every 2
> hours, for 24 hours - but it ran only once.
> When I changed the vbs script (just for testing) - to last for several
> minutes, not 10 hours - it did ran every 2 hours.
> It seems to me that the script does not instantiate itself when it is
> already on-air.
> More important - since I'm working with FTP on the server - is there a
> script that creates/modified/deletes the scheduled tasks, and not
> through the control panel scheduled task GUI?
> Where can I see the Task Scheduler log file?
>
> Thanks,
> Gabi


 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a

 
      12-14-2009



"Gabriela" <> schrieb im Newsbeitrag
news:ea4850fb-d91e-4791-aef6-...
> Thanks.
> The server is Windows 2003 Server.
> That's why I changed it from single task, scheduled to every 2 hours,
> for 24hours - to 12 separate tasks, running the same vbs, scheduled
> for 00:00.02:00,04:00...22:00.
> But all 12 scripts run very weird together - as I wrote above, it's
> like they are synchronizing themselves to run together.
> If I manually run the scripts (by double clicking the vbs) at
> different hours - all works fine - each script runs for ~10hours.
> From scheduled task - they start at 2 hours difference, but finish the
> run at the same second...
> If there's no other option - I will duplicate the vbs scripts.


If you want to run your scripts concurrently then you need to duplicate the
tasks, not the scripts.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: VB script does not run under scheduled task for mapped network dri jford Scripting 1 11-06-2009 12:30 PM
Re: VB script does not run under scheduled task for mapped network drive Pegasus [MVP] Scripting 0 11-04-2009 06:01 PM
Problem setting up scheduled task Mike B Windows Vista Administration 2 01-11-2008 03:09 PM
Missing scheduled task? SonicJoe Windows Vista Performance 6 11-07-2007 06:48 PM
Simple scheduled task won't run - no matter what ! Paul Windows Vista Performance 10 07-10-2007 09:31 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59