I have a Windows service that exits unexpectedly every few days. Is there a simple way to monitor it to make sure it gets restarted quickly if it crashes?
|
Under the Services application, select the properties of the service in question. View the recovery tab - there are all sorts of options - I'd set First & Second Failure to Restart the Service, Third to run a batch program that BLAT's out an email with the third failure notification. You should also set the Reset Fail Count to 1 to reset the fail count daily. EDIT: Looks like you can do this via a command line:
Your MyBatchFile.CMD file can look like this:
|
|||||
|
|
Open Services.msc, double-click on the service to open the Properties of the service, there is a Recovery tab and those settings should allow you to restart the service upon failure. |
|||
|
|
|
I am using ServiceKeeper on my windows 2008 server at HostForLife.eu and it works very good. Previously, I had a review on ServiceHawk, but I prefer to use ServiceKeeper for its easier management and interface. |
|||
|
|
|
This was my answer on a similar thread Hope this helps... You can schedule a simple vbs script like this one to restart periodically the service on the computer if needed.
strComputer = "."
strSvcName = "YOUR_SERVICE_NAME"
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objService = objWMI.Get("Win32_Service.Name='" & strSvcName & "'")
If objService.State= "Stopped" Then
objService.StartService()
End If
|
||||
|
|
|
Someone asked a similar question over at Super User: You could install a tool that monitors windows services. Something like Service Hawk would help you keep the services started, or allow you to schedule automatic restarts (possibly during the night) to keep the service running smoothly. |
|||
|
|