How can I configure a service to automatically restart if it stops?
December 4, 1999
A. Under Windows 2000 the built in support for service recoveryhas been greatly enhanced and using the Computer Management MMC, Services andApplications - Services under the Recovery tab of each service are a number ofdefinable actions to take in the event of the service stopping:
Take no action
Restart the Service
Run a user defined file
Reboot the machine
Click here to view image
This is not possible under Windows NT 4.0 however by writing a custom scriptwhich runs continuously you could achieve a similar effect using a batch file,for example (we use the SC.EXE and SLEEP.EXE resource kit utilities):
:start
sc query spooler > state.txt
find "STOPPED" state.txt
if %errorlevel% EQU 0 goto error
sleep 300
goto start
:error
sc start spooler
sleep 5
goto start
You could add a server name, e.g. sc \server query etc. if you want to checka remote system. Basically the above checks every 5 minutes but you can changeand check multiple services if you like.
There are 3rd products for this purpose also, e.g., Service Plus from http://svclight.activeplus.com/.
About the Author
You May Also Like