Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Critical Services

Status
Not open for further replies.

ButtonIt

Vendor
Apr 1, 2003
127
GB
Hi,

How do I keep my critical services running on my 2k Server? I believe there is a utility that checks each service to make sure it's running, but automatically restarts it if it isn't.
 
The properties of each service has a RECOVERY tab. You can specify in most cases one of the following: Take no action, Restart the service, Run a program, or Restart the computer. Therefore, you could specify restart the service for your "critical" services.
 
Let me piggyback a question onto an old thread.

I read a Win2Ks tip today that provided a vbs script that could be run as a Recovery option for a failed service. It is intended to send an email notification of the stoppage.

I created and referenced this file, with appropriate edits for our email addresses, but when I stopped the service from the product's management console (not from Windows' service panel), no email was received.

Unfortunately the article that contained the tip did not discuss troubleshooting, but I'm hoping that this forum is as helpful as the one I usually participate in.

Here is the core of the vbs script:
Code:
set objArgs = Wscript.Arguments
Set objEmail = CreateObject("CDO.Message")
...
objEmail.Send
Would this require anything special in the way of SMTP services, reliance on Exchange (we use Groupwise), etc.?

Where would one look for error messages if the script had problems? I found nothing in the Event log. I do regularly generate SMTP mail successfully from another service installed with this same product.

Thanks for your help!

- Mike
 
I'm not sure about groupwise (i'm an Exchange guy), but you may have to set the server's IP address to be allowed to relay through.

An alternative would be to use mapisend.exe (from the exchange resource kit) and drop the Exchange (or other MAPI client) on the machine. This can be operated via VBScipt or Batch file very easily.

~Intruder~

"The Less You Do, The Less Can Go Wrong" :)
 
Thanks, Intruder. As it turned out, simply stopping the service did not trigger the recovery action. No real surprise there, although I had hoped that stopping it outside the Control Panel *might* trigger it.

But when the service DID stop due to a failure, an Event was logged that pointed to syntactical errors in the script. I also found that I could simply double-click the script file (with its .vbs extension) and see the run-time errors.

The problem, as it turned out, is that the sample code did not quote the From and To addresses. The script would fail on the "@" as an invalid character.

Since this is a small piece of code, let me post it:
Code:
set objArgs = Wscript.Arguments
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "someone@our.domain"
objEmail.To = "somebody@our.domain"
objEmail.Subject = objArgs(0) & " service is down"
objEmail.Textbody = "The service " & objArgs(0) & " has stopped."
objEmail.Send
set objArgs = nothing
set objEmail = nothing

This is saved as Mail.vbs. The Service's properties page has the Recovery tab, where on first, second, or subsequent failures you choose Run a File. In the Run File dialog, enter the path for Mail.vbs. Enter the Service name in the Command line parameter field. (The original tip suggested a parameter without spaces.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top