队列"/>
[AU3]imail8.0的日志里邮箱出现shutdown后删除队列
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=C:\WINDOWS\system32\SHELL32.dll
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
$g_szVersion = "qq153785587"
If WinExists($g_szVersion) Then
Exit
EndIf
AutoItWinSetTitle($g_szVersion)
$pathini = @ScriptDir & "\pathcfg.ini"
If Not FileExists($pathini) Then
$fileini = FileOpen($pathini, 2)
FileWrite($fileini, "[logpath]" & @CRLF)
FileWrite($fileini, "path=D:\IMail\spool" & @CRLF)
FileWrite($fileini, ";日志文件的路径 不要加\结尾" & @CRLF)
FileWrite($fileini, "qpath=f:\spool" & @CRLF)
FileWrite($fileini, ";队列存放路径 不要加\结尾" & @CRLF)
FileWrite($fileini, "time=5" & @CRLF)
FileWrite($fileini, ";单位是分钟" & @CRLF)
FileClose($fileini)
EndIf
$pathok = IniRead($pathini, "logpath", "path", "NotFound")
$qpathok = IniRead($pathini,"logpath","qpath","NotFound")
$pathtxt = $pathok & "\sys"& @MON & @MDAY & ".txt"
If Not FileExists($pathtxt) Then
WriteLog(False)
Exit
EndIf
$handle = FileOpen($pathtxt)
If $handle = -1 Then
WriteLog(False)
Exit
EndIf
$txt=FileRead($handle)
FileClose($handle)
$patern = ".*\((.*?)\).*shutdown started"
$chyn = StringRegExp($txt,$patern,0)
If $chyn Then
$array = StringRegExp($txt,$patern,3)
for $i = 0 to UBound($array) - 1
$querrypath = $qpathok & "\" & "*" & $array[$i] & "*"
If FileExists($querrypath) Then
RunWait(@ComSpec & " /c " & "net stop queuemgr","",0)
RunWait(@ComSpec & " /c " & "net stop smtpd32","",0)
Sleep(2000)
$PIDq = ProcessExists("queuemgr.exe")
If $PIDq Then ProcessClose($PIDq)
$PIDs = ProcessExists("smtpd32.exe")
If $PIDs Then ProcessClose($PIDs)
If FileDelete($querrypath) Then
WriteLog(True,$querrypath)
Else
WriteLog(True,$querrypath,0)
EndIf
RunWait(@ComSpec & " /c " & "net start queuemgr","",0)
RunWait(@ComSpec & " /c " & "net start smtpd32","",0)
EndIf
Next
EndIf
Func WriteLog($flag,$delname="NO",$success=1)
Local $logpath,$logpathtxt,$file,$temptime
$temptime = @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC
$logpath = @ScriptDir & "\log\" & @YEAR & "\" & @MON ;& @MDAY
If Not FileExists($logpath) Then
DirCreate($logpath)
EndIf
$logpathtxt = $logpath & "\" & @MDAY & ".txt"
$file = FileOpen ( $logpathtxt , 1 )
If $file <> -1 Then
If $flag Then
If $success Then
FileWrite($file,$temptime & " -Delete Filename Success : " & $delname & @CRLF)
Else
FileWrite($file,$temptime & " -Delete File Fail : " & $delname & @CRLF)
EndIf
Else
FileWrite($file, $temptime & " -Error Can't Find " &$pathtxt & " File." & @CRLF)
EndIf
EndIf
FileClose($file)
EndFunc
调用程序
#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=C:\WINDOWS\system32\SHELL32.dll|-115
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
$g_szVersion = "myqq153785587"
If WinExists($g_szVersion) Then
Exit
EndIf
AutoItWinSetTitle($g_szVersion)
HotKeySet("+!d", "EndLog") ;Shift-Alt-d
$delprocessname = "deletelog.exe"
$pathini = @ScriptDir & "\pathcfg.ini"
If Not FileExists($pathini) Then
$fileini = FileOpen($pathini, 2)
FileWrite($fileini, "[logpath]" & @CRLF)
FileWrite($fileini, "path=D:\IMail\spool" & @CRLF)
FileWrite($fileini, ";日志文件的路径 不要加\结尾" & @CRLF)
FileWrite($fileini, "qpath=f:\spool" & @CRLF)
FileWrite($fileini, ";队列存放路径 不要加\结尾" & @CRLF)
FileWrite($fileini, "time=5" & @CRLF)
FileWrite($fileini, ";单位是分钟" & @CRLF)
FileClose($fileini)
EndIf
While 1
$timem = IniRead(@ScriptDir & "\pathcfg.ini","logpath","time",5)
$timem = $timem*60000
;MsgBox(0,"",$timem)
Sleep($timem)
$PID = ProcessExists($delprocessname) ; Will return the PID or 0 if the process isn't found.
If $PID Then ProcessClose($PID)
Run($delprocessname)
;delotherfile()
;$timetemp = @HOUR&@MIN
;If ($timetemp == "00:00") Then
delotherfile()
; Sleep(70000)
;EndIf
WEnd
Func delotherfile()
RunWait(@ComSpec & " /c " & "del /s /f /q d:\*.~bx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q e:\*.~bx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q f:\*.~bx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q d:\IMIP.mbx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q e:\IMIP.mbx","",0)
RunWait(@ComSpec & " /c " & "del /s /f /q f\IMIP.mbx","",0)
EndFunc
Func EndLog()
Exit 0
EndFunc
转载于:.html
更多推荐
[AU3]imail8.0的日志里邮箱出现shutdown后删除队列
发布评论