Ever get stuck with a intermittent application error requiring frequent interaction to help bounce the service if it gets stuck? Sometimes it is necessary to quickly detect an error and act on it immediately. For instance, if a production service such as DRM is crashing intermittently - but the service remains running - how can you effectively triage the issue? Another use case is with development activities. Sometimes during development the environment is somewhat unstable as new features come online - If you are not around to bounce the service do development activities come to a halt?
One option is to identify a specific Windows Event that denotes the error and attach a restart script to have windows automatically restart the service.
Keep in mind I am not recommending that simply bouncing the service it is going to solve the root problem. However, this trick can really cut down on downtime if an issue is present and help you focus on the root cause rather than babysit the symptoms.
Let's say that an intermittent error occurs in DRM which comes out in the Event Log:
If you right click on the event there is an option "Attach task to this event...."
When you select this you are essentially provided the screens to create a Windows scheduled task such as in Task Manager.
At this point, you can quickly configure sending an email to be notified of the event. My favorite option is to run a script by selecting "Start a program":
You can setup a quick script to bounce the service and point to the script.
When finished, be sure to go into advanced properties:
net stop "Oracle DRM Server Processes"
net start "Oracle DRM Server Processes"
date /t >> %LOG%
time /t >> %LOG%
1) set the user to "system"
2) make sure the script runs with highest privileges
That's all there is to it! At this point there is no need to babysit the service - it will detect the error condition automatically and bounce itself. Now you can get on to more important things such as finding that root cause.