소스 검색

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}"