Dim WshShell, oExec, oRun, oCosmiHome, oAdmin, oMngsvut, oCjsleep, oMngHost, oAAHost
Set WshShell = CreateObject("WScript.Shell")
oCosmiHome = WshShell.ExpandEnvironmentStrings("%COSMINEXUS_HOME%")
oAdminac = """" & oCosmiHome & "¥manager¥bin¥adminagentctl"""
oMngsvut = """" & oCosmiHome & "¥manager¥bin¥mngsvrutil"""
oCjsleep = """" & oCosmiHome & "¥CC¥server¥bin¥cjsleep"""
oMngHost = "192.168.0.11" '--- Management Server
oAAHost = "192.168.1.111" '--- Adminagent Server
' ==== Open ====
Function Open( )
Resource.LogInformation "======== Entering Open. ========"
Open = True
End Function
' ==== Online ====
Function Online( )
Resource.LogInformation "======== Entering Online. ========"
'--- mngsvrutil ---
oRun = oMngsvut & " -m " & oMngHost & ":28080 -t " & oAAHost & " -k host -s -l 360 start server"
Set oExec = WshShell.Exec(oRun)
Do While oExec.Status = 0
WshShell.Run oCjsleep & " 1", 0, True
Loop
If oExec.ExitCode <> 0 Then
Resource.LogInformation "### Logical Servers start failed. ### rtn=" & oExec.ExitCode
Resource.LogInformation oExec.StdErr.ReadAll
End If
Online = True
End Function
' ==== LooksAlive ====
Function LooksAlive( )
Resource.LogInformation "======== Entering LooksAlive. ========"
'--- tasklist ---
Set oExec = WshShell.Exec("tasklist /NH /FI ""IMAGENAME eq adminagent.exe""")
Do While oExec.Status = 0
WshShell.Run oCjsleep & " 1", 0, True
Loop
If InStr(1, oExec.StdOut.ReadAll, "adminagent.exe", 1) <> 0 Then
LooksAlive = True
Else
LooksAlive = False
End If
End Function
' ==== IsAlive ====
Function IsAlive( )
Resource.LogInformation "======== Entering IsAlive. ========"
'--- mngsvrutil ---
oRun = oMngsvut & " -m " & oMngHost & ":28080 -t " & oAAHost & " -k host check adminAgent"
Set oExec = WshShell.Exec(oRun)
Do While oExec.Status = 0
WshShell.Run oCjsleep & " 1", 0, True
Loop
If oExec.ExitCode <> 0 Then
Resource.LogInformation "### Administration Agent command failed. ### rtn=" & oExec.ExitCode
Resource.LogInformation oExec.StdErr.ReadAll
IsAlive = False
Else
IsAlive = True
End If
End Function
' ==== Offline ====
Function Offline( )
Resource.LogInformation "======== Entering Offline. ========"
'--- mngsvrutil ---
oRun = oMngsvut & " -m " & oMngHost & ":28080 -t " & oAAHost & " -k host -s -l 360 stop server"
Set oExec = WshShell.Exec(oRun)
Do While oExec.Status = 0
WshShell.Run oCjsleep & " 1", 0, True
Loop
If oExec.ExitCode <> 0 Then
Resource.LogInformation "### Logical Servers stopping failed. ### rtn=" & oExec.ExitCode
Resource.LogInformation oExec.StdErr.ReadAll
End If
Offline = True
End Function
' ==== Close ====
Function Close( )
Resource.LogInformation "======== Entering Close. ========"
End Function
' ==== Terminate ====
Function Terminate( )
Resource.LogInformation "======== Entering Terminate. ========"
End Function |