From a77df3fe52300dd6d6739b7633e451bbdf9218ae Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 1 Dec 2021 10:23:15 +0100 Subject: [PATCH] Rename to check-cpu.ps1 --- Docs/VoiceControl.md | 6 +++++ README.md | 6 ++--- Scripts/{check-cpu-temp.ps1 => check-cpu.ps1} | 20 ++++++++--------- Scripts/check-health.ps1 | 22 +++---------------- 4 files changed, 22 insertions(+), 32 deletions(-) rename Scripts/{check-cpu-temp.ps1 => check-cpu.ps1} (71%) diff --git a/Docs/VoiceControl.md b/Docs/VoiceControl.md index e0579d3f..4adf0732 100644 --- a/Docs/VoiceControl.md +++ b/Docs/VoiceControl.md @@ -94,6 +94,12 @@ Computer, open `name` settings * when finished say: *Computer, close system settings* to stop the Windows settings. +Computer, check `name` +---------------------- +* let the computer check something. +* replace `name` by: "CPU temperature", "DNS", "ping", or "swap space" + + 🔊 Audio ------- * *Computer, mute audio.* diff --git a/README.md b/README.md index 33f4c65a..a9128e85 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,9 @@ Mega Collection of PowerShell Scripts | Script | Description | Help | | ---------------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------- | -| [add-firewall-rules.ps1](Scripts/add-firewall-rules.ps1) | Adds firewall rules for the given executables (needs admin rights) | [Help](Docs/add-firewall-rules.md) | -| [check-cpu-temp.ps1](Scripts/check-cpu-temp.ps1) | Checks the CPU temperature | [Help](Docs/check-cpu-temp.md) | -| [check-dns.ps1](Scripts/check-dns.ps1) | Checks the DNS resolution | [Help](Docs/check-dns.md)| +| [add-firewall-rules.ps1](Scripts/add-firewall-rules.ps1) | Adds firewall rules for the given executables (needs admin rights) | [Help](Docs/add-firewall-rules.md) | +| [check-cpu.ps1](Scripts/check-cpu.ps1)| Checks the CPU temperature | [Help](Docs/check-cpu.md) | +| [check-dns.ps1](Scripts/check-dns.ps1) | Checks the DNS resolution | [Help](Docs/check-dns.md) | | [check-drive-space.ps1](Scripts/check-drive-space.ps1) | Checks a drive for free space left | [Help](Docs/check-drive-space.md) | | [check-file-system.ps1](Scripts/check-file-system.ps1) | Checks the file system of a drive (needs admin rights) | [Help](Docs/check-file-system.md) | | [check-health.ps1](Scripts/check-health.ps1) | Checks the system health | [Help](Docs/check-health.md) | diff --git a/Scripts/check-cpu-temp.ps1 b/Scripts/check-cpu.ps1 similarity index 71% rename from Scripts/check-cpu-temp.ps1 rename to Scripts/check-cpu.ps1 index 5bfd28b1..395ae361 100755 --- a/Scripts/check-cpu-temp.ps1 +++ b/Scripts/check-cpu.ps1 @@ -1,11 +1,11 @@ <# .SYNOPSIS - Checks the CPU temperature + Checks the CPU .DESCRIPTION This script checks the CPU temperature. .EXAMPLE - PS> ./check-cpu-temp - ✔️ CPU has 30.3 °C: good + PS> ./check-cpu + ✔️ CPU has 30.3 °C .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -23,18 +23,18 @@ try { } if ($Temp -gt 80) { - "⚠️ CPU has $Temp °C: too high!" - exit 1 + $Reply = "⚠️ CPU has $Temp °C: too high!" } elseif ($Temp -gt 50) { - "✔️ CPU has $Temp °C: quite high" + $Reply = "✔️ CPU has $Temp °C: quite high" } elseif ($Temp -gt 0) { - "✔️ CPU has $Temp °C" + $Reply = "✔️ CPU has $Temp °C" } elseif ($Temp -gt -20) { - "✔️ CPU has $Temp °C: quite low" + $Reply = "✔️ CPU has $Temp °C: quite low" } else { - "⚠️ CPU has $Temp °C: too low!" - exit 1 + $Reply = "⚠️ CPU has $Temp °C: too low!" } + "$Reply" + & "$PSScriptRoot/speak-english.ps1" "$Reply" exit 0 # success } catch { "⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))" diff --git a/Scripts/check-health.ps1 b/Scripts/check-health.ps1 index f28b907b..5e08d024 100755 --- a/Scripts/check-health.ps1 +++ b/Scripts/check-health.ps1 @@ -8,7 +8,7 @@ ✔️ 1213 GB left for swap space (67 of 1280 GB used) ✔️ 172 GB left on drive C (61 of 233 GB used) ✔️ 30.3 °C CPU temperature - good - ✔️ 19.7 domains/s (177 domains resolved in 9 sec) + ✔️ DNS resolution is 19.7 domains per second ✔️ 29 ms ping average (13 ms min, 110 ms max, 10 hosts) ✔️ Windmill is healthy .LINK @@ -18,8 +18,6 @@ License: CC0 #> -$Healthy = 1 - & "$PSScriptRoot/check-swap-space.ps1" if ($lastExitCode -ne "0") { $Healthy = 0 } @@ -31,25 +29,11 @@ if ($IsLinux) { if ($lastExitCode -ne "0") { $Healthy = 0 } } -& "$PSScriptRoot/check-cpu-temp.ps1" -if ($lastExitCode -ne "0") { $Healthy = 0 } - +& "$PSScriptRoot/check-cpu.ps1" & "$PSScriptRoot/check-dns.ps1" -if ($lastExitCode -ne "0") { $Healthy = 0 } - & "$PSScriptRoot/check-ping.ps1" -if ($lastExitCode -ne "0") { $Healthy = 0 } - if ($IsLinux) { & "$PSScriptRoot/check-smart-devices.ps1" if ($lastExitCode -ne "0") { $Healthy = 0 } } - -$Hostname = $(hostname) -if ($Healthy) { - "✔️ $Hostname seems healthy" - exit 0 # success -} else { - write-warning "$Hostname is NOT healthy" - exit 1 -} +exit 0 # success