Improved both scripts

This commit is contained in:
Markus Fleschutz 2021-03-29 17:09:59 +02:00
parent c297f70046
commit b4ba271ff2
2 changed files with 5 additions and 4 deletions

View File

@ -8,8 +8,8 @@
try {
if (test-path "/sys/class/thermal/thermal_zone0/temp") {
$Temp = get-content "/sys/class/thermal/thermal_zone0/temp"
$Temp = $Temp / 1000.0
[int]$IntTemp = get-content "/sys/class/thermal/thermal_zone0/temp"
$Temp = [math]::round($IntTemp / 1000.0, 1)
} else {
write-warning "Sorry, no CPU temperature available"
exit 0
@ -26,7 +26,7 @@ try {
} elseif ($Temp -lt "0") {
write-warning "CPU has $Temp °C - quite low"
} else {
write-host -foregroundColor green "OK - CPU has $Temp °C"
write-host -foregroundColor green "OK - $Temp °C CPU temperature"
}
exit 0
} catch {

View File

@ -21,7 +21,8 @@ try {
$Count = $Table.Length
$StopTime = Get-Date
$TimeInterval = New-Timespan -start $StartTime -end $StopTime
write-host -foregroundColor green "OK - resolved $Count domain names in $($TimeInterval.seconds) seconds"
$Average = [math]::round($Count / $TimeInterval.seconds, 1)
write-host -foregroundColor green "OK - $Average domains/s ($Count domains resolved in $($TimeInterval.seconds) seconds)"
exit 0
} catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"