diff --git a/scripts/check-temperature.sh b/scripts/check-temperature.sh index b0c851a..e6eab9c 100755 --- a/scripts/check-temperature.sh +++ b/scripts/check-temperature.sh @@ -11,12 +11,12 @@ if ! command -v sensors &>/dev/null; then exit 0 fi -# Get CPU temperature -TEMPS=$(sensors 2>/dev/null | grep -E "Core.*:.*°C" || echo "") +# Get CPU temperature - only extract the actual reading (first temperature value after colon) +TEMPS=$(sensors 2>/dev/null | grep -E 'Core.*:' | grep -oP ':\s+\+\K[0-9]+\.[0-9]+' || echo "") if [ -n "$TEMPS" ]; then - # Extract highest temperature - MAX_TEMP=$(echo "$TEMPS" | grep -oP '\+\K[0-9]+' | sort -n | tail -1) + # Extract highest temperature (rounded to integer) + MAX_TEMP=$(echo "$TEMPS" | sort -n | tail -1 | cut -d. -f1) if [ "$MAX_TEMP" -gt 90 ]; then $SEND_NTFY critical "Temperature Critical" "🔴 CRITICAL: PVE CPU temperature at ${MAX_TEMP}°C! System may shut down!" "fire,skull,thermometer"