-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurrent.ps1
48 lines (36 loc) · 895 Bytes
/
current.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
$ok = 0
$nok = 0
$err = 0
$i = 0
$url = 'http://10.0.0.50:8080/global/lm'
while($i -lt 6){
$request = Invoke-WebRequest -Uri $url
if($request.StatusCode -eq "200"){
Write-url "$url - ok"
$ok ++
$err = 0
}
else{
Write-url "$url - error"
$nok ++
$err ++
}
if($err -eq 3){
Write-url "$url - down"
Write-url "Stopping Service railo-iqweb"
Stop-Service railo-iqweb
Write-url "Waiting 10 seconds to start railo-iqweb"
Start-Sleep -s 10
Write-url "Starting Service railo-iqweb"
Start-Service railo-iqweb
Write-url "$url - down"
Write-url "Waiting 30 seconds before resuming check"
Start-Sleep -s 30
}else{
Start-Sleep -s 10
}
$i++
}
Write-url “Loop complete”
Write-url “ok: $ok”
Write-url “nok: $nok”