开发者

Batch program to restart of a service if it throws error in event viewer

I want a batch program that will restart a service if that service current开发者_C百科ly throws a error in eventviewer .


If you open the Services management console (services.msc), go to the Properties for the service, and select the 'Recovery' tab, you can set the service to restart after failure.


There's no way for a batch file to know the service "throws an error in eventviewer", since a batch file can't access the event logs and wouldn't get notified there was an event there if it could.

The usual way to deal with this issue is to set the service to restart after failure in the service's properties. The other option used is to write an application that monitors the service and restarts it if it stops. It's usually called a 'guardian' application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜