20 lines
455 B
Bash
20 lines
455 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
declare -i hwmon_nr=$(( $(cat -n /sys/class/hwmon/hwmon*/name | grep -oP '\d+\s+k10temp' | grep -oP '^\d+') - 1))
|
||
|
|
||
|
temp=$(cat /sys/class/hwmon/hwmon$hwmon_nr/temp1_input | cut -c -2)
|
||
|
|
||
|
if [[ $temp -lt 45 ]]; then
|
||
|
class=low
|
||
|
elif [[ $temp -lt 70 ]]; then
|
||
|
class=normal
|
||
|
elif [[ $temp -lt 80 ]]; then
|
||
|
class=high
|
||
|
else
|
||
|
class=alert
|
||
|
fi
|
||
|
|
||
|
cat << EOF
|
||
|
{"text": "$temp°C", "alt": "$class", "tooltip": "$temp°C", "class": "$class", "percentage": ""}
|
||
|
EOF
|