SoftwareTipsandTricks Forum

Go Back   SoftwareTipsandTricks Forum > Operating Systems > Windows NT/2000/2003
User Name
Password


Remotely Restarting a Service Reliably

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes

  #1  
Old 12-20-2007, 08:20 AM
humbletech99 Offline
Registered User
 
Join Date: Aug 2005
Posts: 95
Remotely Restarting a Service Reliably

I need to be able to reliably and remotely restart a service from cmd/batch.

So far I have been doing
Code:
sc \\server stop servicename sc \\server start servicename
But because of a timing issue this invariably leaves the service as just stopped. So I introduced a time wait between the two commands, but this doesn't always work, if the server is slow to respond to the first one, it's not ready by the time of the second one and the service never restarts.

Anyone got any good reliable method for restarting a service and making sure it comes back up from cmd/batch?
Reply With Quote

  #2  
Old 12-21-2007, 04:44 AM
DaveC2003's Avatar
DaveC2003 Offline
Registered User
 
Join Date: Jul 2005
Location: Aberdeen
Posts: 707
Send a message via MSN to DaveC2003
Take a look at the link below:

http://www.windowsnetworking.com/kba...sRemotely.html

Hope this helps.
__________________
DaveC2003
Reply With Quote

  #3  
Old 12-21-2007, 08:32 AM
humbletech99 Offline
Registered User
 
Join Date: Aug 2005
Posts: 95
netsvc is not available by default and really it doesn't look any better than sc.

It is still limited to start and stop, no restart. My problem with sc is that it doesn't wait for confirmation of the stop before sending the start, and having a generic sleep time between the two calls has proven to be wildly unreliable.

So that's netsvc out of the equation, sc out as well, and net start/stop only works locally.
Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spyware and Virus Issues, Hijack this Logfile contained Please Help the man Windows XP 3 10-29-2007 04:20 AM
Problems after a virus/malware. please help matt_coates Windows XP 16 10-05-2007 04:08 AM
Help needed! - HijackThis v1.99.1 Log Haplo Windows XP 1 07-21-2006 12:35 AM
hijackthis log j00bhaka Windows XP 1 11-11-2005 09:18 AM
Desktop Wont Load shredmaster1013 Windows XP 6 08-14-2005 06:52 AM



All times are GMT -5. The time now is 06:43 AM.


Designed by eXtremepixels. Powered by vBulletin Version 3.5.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 2.3.2 © 2005, Crawlability, Inc.