A. Under Windows 2000 the built in support for service recovery has been greatly enhanced and using the Computer Management MMC, Services and Applications - Services under the Recovery tab of each service are a number of definable actions to take in the event of the service stopping:
- Take no action
- Restart the Service
- Run a user defined file
- Reboot the machine
This is not possible under Windows NT 4.0 however by writing a custom script which 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<br> sc query spooler > state.txt<br> find "STOPPED" state.txt<br> if %errorlevel% EQU 0 goto error<br> sleep 300<br> goto start<br><br> :error<br> sc start spooler<br> sleep 5<br> goto start
You could add a server name, e.g. sc \\server query etc. if you want to check a remote system. Basically the above checks every 5 minutes but you can change and check multiple services if you like.
There are 3rd products for this purpose also, e.g., Service Plus from http://svclight.activeplus.com/.