Win under the server Tomcat check to detect if the Tomcat port is hanging off, if the automatic restart is suspended. The script is as follows
#include <File.au3>
; Tomcat Directory
$tomcatDir = "C:\ovk\apache-tomcat-7.0.55\bin\"
; VLC Directory
$vlcPath = "C:\Program Files\videolan\vlc\vlc.exe"
; Self Channel 1 file filename must be ziban1.ts
$ziban 1Path = "C:\pingdao\ziban1.ts"
, Self Channel 1 multicast address
$ziban 1Dest = "238.1.1.36:3000"
; Self Channel 2 file filename must be ziban2.ts
$ziban 2Path = "C:\pingdao\ziban2.ts"
, Self Channel 2 multicast address
$ziban 2Dest = "238.1.1.37:3000"
; Self Channel 3 file filename must be ziban3.ts
$ziban 3Path = "C:\pingdao\ziban3.ts"
, Self Channel 3 multicast address
$ziban 3Dest = "238.1.1.38:3000"
The following configuration notes: Monday and Saturday 9:45 will restart the Tomcat service
; Automatically restart the week? Wednesday
$wday 1 = 4
; Automatically restart the week? Saturday
$wday 2 = 7
; Automatic restart hours? 3 pips
$hour 1 = 11
; Automatic restart minutes? 0 min
$min 1 = 27
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Opt ("Traymenumode", 0)
Opt ("Trayautopause", 0)
Opt ("Trayiconhide", 0)
Opt ("Trayiconhide", 0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Traysettooltip ("Ostv daemon")
Traytip ("Hint:", "OSTV service program has started!") ", 10, 1)
Sleep (2000)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While True
Local $sDate = @YEAR & "-" & @MON & "-" & @MDAY
If not winexists ("Tomcatostv") Then
Run ($tomcatDir & "Startup.bat", $tomcatDir)
Traytip ("Warning:", "detected that Tomcat is not started and is turned on again!") ", 10, 2)
_filewritelog (@ScriptDir & "\" & $sDate & ". Log", "Tomcatostv crashed!")
EndIf
If not winexists ("ZIBAN1.TS-VLC Media Player") then
Sleep (5000)
If not winexists ("ZIBAN1.TS-VLC Media Player") then
Traytip ("Warning:", "detected self Channel 1 not started, has been reopened!") ", 10, 2)
Run ($vlcPath & "& $ziban 1Path &"--loop--sout= #duplicate {dst=std{access=udp,mux=ts,dst= "& $ziban 1De St & "}}")
_filewritelog (@ScriptDir & "\" & $sDate & ". Log", "Ziban1 crashed!")
EndIf
EndIf
If not winexists ("ZIBAN2.TS-VLC Media Player") then
Sleep (5000)
If not winexists ("ZIBAN2.TS-VLC Media Player") then
Traytip ("Warning:", "detected self Channel 2 not started, has been reopened!") ", 10, 2)
Run ($vlcPath & "& $ziban 2Path &"--loop--sout= #duplicate {dst=std{access=udp,mux=ts,dst= "& $ziban 2De St & "}}")
_filewritelog (@ScriptDir & "\" & $sDate & ". Log", "Ziban2 crashed!")
EndIf
EndIf
If not winexists ("ZIBAN3.TS-VLC Media Player") then
Sleep (5000)
If not winexists ("ZIBAN3.TS-VLC Media Player") then
Traytip ("Warning:", "detected self channel 3 not started, has been reopened!") ", 10, 2)
Run ($vlcPath & "& $ziban 3Path &"--loop--sout= #duplicate {dst=std{access=udp,mux=ts,dst= "& $ziban 3De St & "}}")
_filewritelog (@ScriptDir & "\" & $sDate & ". Log", "Ziban3 crashed!")
EndIf
EndIf
Sleep (10000)
if @WDAY = = $wday 1 Or @WDAY = = $wday 2 Then
if @HOUR = = $hour 1 and @MIN = = $min 1 Then
Traytip ("Hint:", "the Tomcat service will restart in 20 seconds after the scheduled time!") ", 10, 1)
_filewritelog (@ScriptDir & "\" & $sDate & ". Log", "Tomcatostv'll restart in 20s!")
Sleep (20000)
Run ($tomcatDir & "Shutdown.bat", $tomcatDir)
Sleep (10000)
Run ($tomcatDir & "Startup.bat", $tomcatDir)
Traytip ("Hint:", "Tomcat service started successfully!") ", 10, 1)
_filewritelog (@ScriptDir & "\" & $sDate & ". Log", "Tomcatostv restarted!")
Sleep (20000)
EndIf
EndIf
Wend
This article is from "Ghost" blog, please make sure to keep this source http://fangwei009.blog.51cto.com/5234706/1690177
Monitor Tomcat Service script under Window server