Re: Batch script for maintaing remote services
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Thu, 19 Feb 2009 16:20:28 +0100
*** See below.
"test" <harpreet.noni@xxxxxxxxx> wrote in message
news:26363214-a7e3-4000-932a-e8219a2c7aec@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Greetings,*** Probably, but if this is what you want then you should
I want to maintain (stop/start) services on remote machine in orderly
fashion. The requirement is that the next service should only be
started/stopped when previous service has stopped/started completely.
I am using Windows xp. I am able to come up with something like below:
REM ** To stop services on remote machine **
start /wait sc \\server_name stop service_name1
start /wait sc \\server_name stop service_name2
REM ** To start services on remote machine **
start /wait sc \\server_name start service_name1
start /wait sc \\server_name start service_name2
Is it true that above command means that service_name2 will only
stop/start when the first service i.e service_name1 gets
stopped/started completely?
*** drop the "start" command altogether:
*** sc \\Server_Name stop service_name1
Also, I have one more issue. Sometimes when the service is getting*** In such cases you need a loop, e.g. like so:
stopped, it goes into a "intermediate" state as STOPPING. In this
case, I want to kill this service before sc command go on stopping
next services.
***
*** sc \\Server_Name stop service_name1
*** :Loop1
*** ping localhost -n 10 > nul
*** sc \\Server_Name query service_name1 | find /i "stopped || goto Loop1
***
*** You should also add a loop counter in order to deal
*** with cases where the service can't be stopped.
Can someone please help me here. I have searched enough and not able
to come to any conclusion.
TIA
.
- Follow-Ups:
- References:
- Batch script for maintaing remote services
- From: test
- Batch script for maintaing remote services
- Prev by Date: Re: missing a dll file
- Next by Date: game controller control panel (joy.cpl) will not open
- Previous by thread: Batch script for maintaing remote services
- Next by thread: Re: Batch script for maintaing remote services
- Index(es):
Relevant Pages
|