`

定时任务 tomcat

阅读更多
on   error   resume   Next  

Dim   a   ,sRunTime,aTime,iHour,iMinute
a   =   True   

sRunTime = "15:37"
aTime = Split(sRunTime, ":")
iHour = CInt(aTime(0))
iMinute = CInt(aTime(1))

Do While a
If (Hour(Now) = iHour) And (Minute(Now) = iMinute) Then
set   WshShell   =   WScript.CreateObject( "WScript.Shell ")
set fs =createobject("scripting.filesystemobject")
  
WshShell.Run( "net   stop   Tomcat6 ")  
WScript.Sleep(1000*3)  
set ts =fs.opentextfile("c:\22.txt",8,true)

ts.write "start"
ts.write "-------error time:"
ts.write now
ts.writeblanklines 2
ts.close
End If

loop




Option Explicit

On Error Resume Next
Dim sProgramme, sRunTime, aTime, iHour, iMinute, oShell
sProgramme = "E:\22.vbs" '------指定程序路径
sRunTime = "6:20" '------指定运行时间
aTime = Split(sRunTime, ":")
iHour = CInt(aTime(0))
iMinute = CInt(aTime(1))


Do While True
If (Hour(Now) = iHour) And (Minute(Now) = iMinute) Then
Set oShell = CreateObject("WScript.Shell")
oShell.Run sProgramme, 1, False
Set oShell = Nothing
Exit Do
End If
WSH.Sleep 1000
Loop







分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics