Przeglądaj źródła

bugfix and tee output

Tobias Simetsreiter 4 lat temu
rodzic
commit
5c1244f635
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      Monitor_http.ps1

+ 3 - 3
Monitor_http.ps1

@@ -19,7 +19,7 @@ try {
     $success = $false
 }
 
-if ($success -and $Response.StatusCode -ne 200){
+if ((-not $success) -and $Response.StatusCode -ne 200){
     "Stopping Service ${ServiceName}"
     net stop  $ServiceName
     "Stopped Service ${ServiceName}"
@@ -33,7 +33,7 @@ if ($success -and $Response.StatusCode -ne 200){
 }
 
 try {
-    main >> $logfile
+    main | Tee-Object $logfile -Append
 } catch {
-    $_.exception >> $logfile
+    $_.exception | Tee-Object $logfile -Append
 }