mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-30 11:54:32 +01:00
Improved check-cpu-temp.ps1
This commit is contained in:
parent
3e4abf7b30
commit
dbea806772
@ -11,12 +11,20 @@ try {
|
|||||||
$Temp = get-content "/sys/class/thermal/thermal_zone0/temp"
|
$Temp = get-content "/sys/class/thermal/thermal_zone0/temp"
|
||||||
$Temp = $Temp / 1000.0
|
$Temp = $Temp / 1000.0
|
||||||
} else {
|
} else {
|
||||||
write-warning "No CPU temperature available"
|
write-warning "Sorry, no CPU temperature available"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Temp -gt "80") {
|
if ($Temp -gt "80") {
|
||||||
write-warning "CPU has $Temp °C!"
|
write-error "CPU has $Temp °C - too high!"
|
||||||
|
exit 1
|
||||||
|
} elseif ($Temp -lt "-20") {
|
||||||
|
write-error "CPU has $Temp °C - too low!"
|
||||||
|
exit 1
|
||||||
|
} elseif ($Temp -gt "50") {
|
||||||
|
write-warning "CPU has $Temp °C - quite high"
|
||||||
|
} elseif ($Temp -lt "0") {
|
||||||
|
write-warning "CPU has $Temp °C - quite low"
|
||||||
} else {
|
} else {
|
||||||
write-host -foregroundColor green "OK - CPU has $Temp °C"
|
write-host -foregroundColor green "OK - CPU has $Temp °C"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user