Re: obshell.run hangs (2)




"57Pan" <change-this-to-just-dave@xxxxxxxxxxxxx> wrote in message
news:dncjto$mpc$1@xxxxxxxxxxxxxxxxxxxxx
> Al Dunbar wrote:
>>>
>>>Thanks for the reply.
>>>
>>>Actually, running the sub processes asynchronously was the intention of
>>>doing it this way. We have three processes that are somewhat related to
>>>each other but do not necessarily have to be run sequentially, so the
>>>main script runs a loop that just launches each sub process at a certain
>>>interval. My thinking was that by spawning separate processes I could
>>>prevent problems in one process from affecting the other processes.
>>
>>
>> Could be. Depends on what type of problems you are talking about, though,
>> whether this is the best way to do it.
>>
>>
>>>I'm sure there are other ways to accomplish this and if I were starting
>>>over from scratch there are things I would do differently, but it seemed
>>>like a good plan at the time.
>>
>>
>> Hey, if it works, it works.
>>
>>
>>>This is one of those scripts that kind of took on a life of its own. It
>>>started out as a simple script and then we found that it could be useful
>>>for doing some other things as well between process intervals and now the
>>>total script is over 1200 lines.
>>
>>
>> Hey, if it works... but doesn't it get a little messy when a script grows
>> organically like that rather than by design?
>>
>>
>>>Anyway, as I mentioned in a reply to another person, I have replaced the
>>>objshell.run commands. I'm now using objWMIService.Create to run the
>>>external program in a separate process, then I loop until that process
>>>ends before resuming my script.
>>
>>
>> That's an interesting approach, but if the calling script waits for the
>> spawned process to complete before continuing, isn't that simulating a
>> synchronous approach?
>>
>>
>>>Last nite was the first time a long time that I did not get text message
>>>alerts at all hours of the nite telling me that the script was hung :-)
>>
>>
>> Great.
>>
>> /Al
>>
>>
>
> Well... the more I explain about how this system works the more apparent
> it will be to everyone that I'm not really a programmer ;) I'm a systems
> adminstrator who writes scripts to make my job easier. Hence, my scripts
> tend to grow organically rather than by design.

There is certainly no shame in that, especially if you are getting some
useful work done. Some would say that "real programmers" would tend not to
use something that many of them would consider as not a "real programming
language"!

> Yes, in a sense, it is simulating a synchronous approach. But only within
> the SUBscript that is actually creating the WMIservice for the external
> program. The SUBscript (and there are several of them) is being launched
> from the MAINscript which is in a continuous loop firing off the
> SUBscripts in a more-or-less asynchronous manner dictated by a
> pre-determined interval. However, the MAINscript will not launch a
> SUBscript if it senses that there is already an instance of that SUBscript
> running. And if it senses that the SUBscript has been running for an
> extraordinarily long time it will send a text msg via smtp to my cell
> phone.

The main purpose of your "SUBscripts" seems to be to act as a wrapper for
whatever is being run as a service, and thereby to allow the MAINscript to
determine whether or not the process has completed its work to avoid running
multiple instances of any of the "services", but without requiring the
MAINscript to wait for each one to complete before launching a different
one.

Without knowing the details, I cannot say whether or not there might be a
simpler way to do this. I might structure it differently, and instead of
launching the SUBscripts as separate jobs from the same .wsf file, run the
default job and pass it a parameter to indicate which SUBscript is to be
run. Given that your method works, though, I wouldn't necessarily see any
value in your making this particular change.

/Al


.



Relevant Pages

  • Re: convert FAT32 to NTFS problem?
    ... sDiskLetter = obiLogicalDisk.DeviceID ... >>> Your script is always launching convert.exe on the local machine. ... >>> script connects to the remote computer using WMI, and gets the drives of the ...
    (microsoft.public.scripting.vbscript)
  • Re: Checking for running process
    ... > I've created a simple WSH script for the Win2000 computers in my kid's ... classroom that attempts to solve the problem of the kids launching multiple ... get impatient and click multiple times and launch the app a bunch of times. ... its own PID. ...
    (microsoft.public.scripting.wsh)
  • Re: script calling script - early termination
    ... > own bookshelf, and if I've seen the answer I've not recognized it as ... > exit $status ... > the subscript is what is short-circuiting things, ... so am looking for something I can do in the parent script when I ...
    (comp.unix.shell)
  • Re: A question about multithreading
    ... cores is nearly fully utilized (about 95% of that one core's cycles. ... same priority as the process, or are they given lower priority. ... one commonality in how I was launching the SQL scripts was that the ... script was invoked taking the script from one file and sending the ...
    (comp.lang.perl.misc)
  • cross domain permission denied problem
    ... Hi folks, I'm trying to access window opener properties for some ad ... Sometimes the launching page is in a different domain, ... my script to recognize this fact and move on to something else without ...
    (comp.lang.javascript)