-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwatchkano2.ps1
More file actions
42 lines (32 loc) · 1.07 KB
/
watchkano2.ps1
File metadata and controls
42 lines (32 loc) · 1.07 KB
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
$processName = "kano-test" # bez .exe
$checkInterval = 5
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$alarmSound = Join-Path $scriptDir "axe-sfx.wav"
$wasRunning = $false
Add-Type -AssemblyName System.Windows.Forms
while ($true) {
$process = Get-Process -Name $processName -ErrorAction SilentlyContinue
if ($process) {
$wasRunning = $true
}
else {
if ($wasRunning) {
if (Test-Path $alarmSound) {
$player = New-Object System.Media.SoundPlayer $alarmSound
$player.Play()
}
else {
[System.Media.SystemSounds]::Hand.Play()
}
# Kano běželo a teď neběží = PROBLÉM
[System.Windows.Forms.MessageBox]::Show(
"KANO IS DOWN!",
"KANO WATCHDOG",
[System.Windows.Forms.MessageBoxButtons]::OK,
[System.Windows.Forms.MessageBoxIcon]::None
)
$wasRunning = $false
}
}
Start-Sleep -Seconds $checkInterval
}