浏览代码

fix monitor logic

Tobias Simetsreiter 4 年之前
父节点
当前提交
e54e43865d
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Monitor_http.ps1

+ 2 - 1
Monitor_http.ps1

@@ -5,6 +5,7 @@ param(
 
 $Date = Get-Date
 
+mkdir -Force ".\logs" | Out-Null
 $logfile = ".\logs\Monitor_http_{0}-{1}-{2}.log" -f ($Date.Year,$Date.Month,$Date.Day)
 
 Function main(){
@@ -19,7 +20,7 @@ try {
     $success = $false
 }
 
-if ((-not $success) -and $Response.StatusCode -ne 200){
+if ((-not $success) -or $Response.StatusCode -ne 200){
     "Stopping Service ${ServiceName}"
     net stop  $ServiceName
     "Stopped Service ${ServiceName}"