mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-16 17:51:28 +01:00
Add check-cpu-temp.ps1
This commit is contained in:
parent
85d3137b14
commit
1fc4d5af0e
@ -1,5 +1,6 @@
|
||||
Script,Description
|
||||
add-firewall-rules.ps1, adds firewall rules to the given executables (requires admin rights)
|
||||
check-cpu-temp.ps1, checks the CPU temperature
|
||||
check-dns-resolution.ps1, checks the DNS resolution with frequently used domain names
|
||||
check-drive-space.ps1, checks the given drive for free space left
|
||||
check-health.ps1, checks the system health
|
||||
|
|
@ -30,6 +30,7 @@ Collection of PowerShell Scripts
|
||||
⚙️ Scripts for Computer Management
|
||||
---------------------------------
|
||||
* [add-firewall-rules.ps1](Scripts/add-firewall-rules.ps1) - adds firewall rules for the given executables (requires admin rights)
|
||||
* [check-cpu-temp.ps1](Scripts/check-cpu-temp.ps1) - checks the CPU temperature
|
||||
* [check-dns-resolution.ps1](Scripts/check-dns-resolution.ps1) - checks the DNS resolution with frequently used domain names
|
||||
* [check-drive-space.ps1](Scripts/check-drive-space.ps1) - checks the given drive for free space left
|
||||
* [check-health.ps1](Scripts/check-health.ps1) - checks the system health
|
||||
|
23
Scripts/check-cpu-temp.ps1
Executable file
23
Scripts/check-cpu-temp.ps1
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/powershell
|
||||
<#
|
||||
.SYNTAX ./check-cpu-temp.ps1
|
||||
.DESCRIPTION checks the CPU temperature
|
||||
.LINK https://github.com/fleschutz/PowerShell
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
try {
|
||||
if (test-path "/sys/class/thermal/thermal_zone0/temp") {
|
||||
$Temp = get-content "/sys/class/thermal/thermal_zone0/temp"
|
||||
$Temp = $Temp / 1000.0
|
||||
} else {
|
||||
write-warning "No CPU temperature retrieved"
|
||||
exit 0
|
||||
}
|
||||
|
||||
write-host -foregroundColor green "OK - CPU has $Temp °C"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
@ -22,7 +22,7 @@ try {
|
||||
write-warning "Drive $Drive has only $Free GB left to use! ($Used GB out of $Total GB in use, minimum is $MinLevel GB)"
|
||||
exit 1
|
||||
}
|
||||
write-host -foregroundColor green "OK - $Free GB free at drive $Drive ($Used GB used out of $Total GB, $MinLevel GB is minimum)"
|
||||
write-host -foregroundColor green "OK - drive $Drive has $Free GB left ($Used GB used out of $Total GB, $MinLevel GB is minimum)"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
@ -15,10 +15,14 @@ try {
|
||||
|
||||
if ($IsLinux) {
|
||||
& check-drive-space.ps1 /
|
||||
if ($lastExitCode -ne "0") { throw "check-drive-space.ps1 failed" }
|
||||
} else {
|
||||
& check-drive-space.ps1 C
|
||||
if ($lastExitCode -ne "0") { throw "check-drive-space.ps1 failed" }
|
||||
}
|
||||
if ($lastExitCode -ne "0") { throw "check-drive-space.ps1 failed" }
|
||||
|
||||
& check-cpu-temp.ps1
|
||||
if ($lastExitCode -ne "0") { throw "check-cpu-temp.ps1 failed" }
|
||||
|
||||
if (-not($IsLinux)) {
|
||||
& check-windows-system-files.ps1
|
||||
|
@ -27,7 +27,7 @@ try {
|
||||
write-warning "Swap space has only $Free GB left to use! ($Used GB out of $Total GB in use, minimum is $MinLevel GB)"
|
||||
exit 1
|
||||
}
|
||||
write-host -foregroundColor green "OK - $Free GB free swap space ($Used GB used out of $Total GB, minimum is $MinLevel GB)"
|
||||
write-host -foregroundColor green "OK - swap space has $Free GB left ($Used GB used out of $Total GB, minimum is $MinLevel GB)"
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user