• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Script to monitor windows service?

FreshPrince

Diamond Member
Dec 6, 2001
8,361
1
0
does anyone know of any free or commercial solution that'll monitor windows server service and restart it if it stops?

Thanks,

-FP
 

mobly99

Senior member
Apr 27, 2001
260
0
0
just create a batch file to do it and schedule it to run at whatever interval you want to check.

for example - this would check for a service called Symantec AntiVirus Client to be running (findstr is case sensitive) and would restart it if if is not running.


net start | findstr /C:"Symantec AntiVirus Client"
if %errorlevel% == 1 goto restart

:end
exit

:restart
net start "Symantec AntiVirus Client"




-Dave
 

mikecel79

Platinum Member
Jan 15, 2002
2,858
1
81
Why not just set this particular service to restart if it's stopped? Go to properties on the service you want to monitor and choose the recovery tab. Set it to restart the service on failure.