ServersCheck watchdog

[Deleted User][Deleted User]

To anyone who cares:

Here is the vbs code for creating a watchdog for the serverscheck service running from other machine:

' WofWof - Mk 1
' Rui Martins

Public svc, command, log, teste, mail, srv
Const ForReading = 1, ForWriting = 2, ForAppending = 8


command = "cmd /c c:WofWofnetsvc ServersCheck apis /query > c:WofWofapis-ServersCheck.log"
log = "c:WofWofapis-ServersCheck.log"
teste = "Service is running on apis"
mail = "c:WofWofmailto -U WofWof-no-ae023029 -D [email protected] -H hermes -S ATENCAO_O_Service_ServersCheck_nao_esta_no_ar"

Dim fso, MyFile

' Carrega para ficheiro o estado da execução do netsvc

dim objWshShell
Set objWshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

objWshShell.Run command , 1, true

WScript.Sleep 2000

' Vê o estado da execução do Netsvc

Set MyFile = fso.OpenTextFile(log, ForReading)

mquery = MyFile.ReadLine
MyFile.Close

if mquery <> teste Then
ObjWshShell.Run mail
End If

it uses the mailto.exe free utility and netsvc resource kit utility

This vbs runs as task every 6 minutes in order to check is the serverscheck service is running. It send an email if it´s not.

regard

This discussion has been closed.