Jump to content

Monitor Restart Service* Mod

Recommended Posts

Hey crew,

How is it going? I would like to make a modify the Monitor Restart Service* script by adding this command:

SC Failure "Service" actions= restart/60000ms/restart/60000/restart/60000ms// reset= 3600000

This will change the Services -> Recovery tab -> First Failure to - Restart the Service, Second Failure to - Restart the Service, and Subsequent Failure to - Restart the Service.

Anyone know how to add that command? Im not great at scripts and this one in-particular has alot of lines to it, Im not sure where to begin.

Any help would be great!

Thanks guys!

Edited by Shaggy2

Share this post

Link to post
Share on other sites

It looks like you have the command line worked out. My script (which may or may not be modified) has the following on steps 78-80: 

78,       START SERVICE:  @fieldname@
79,       Sleep 60 seconds
80,       Resend Service List

I would add two steps. First, a Variable Check to see if the service name is one that you have defined (so that you don't enable recovery for EVERY single service that you find stopped one time) and then a Shell step to set the failure recovery parameters.


78,       START SERVICE:  @fieldname@
79,       Sleep 60 seconds
80,       IF  @fieldname@  Not In  LTSvcMon,Spooler,WSearch  THEN  Jump to line 82
81,       SHELL:  SC.EXE Failure "@fieldname@" actions= restart/60000/restart/60000/restart/60000 reset= 3600000 and store the result in %shellresult%
82,       Resend Service List

Make sure that steps 80/81 are limited to Windows agents only, and that step 81 is set to "Continue On Failure" (you don't want an error from that step to fail the whole script).

  • Like 1

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...