Handle AMD CPU temp on ASUS motherboards
This commit is contained in:
parent
235bf058e5
commit
09379eebc0
@ -8,6 +8,20 @@ if [ ! -d $cache_dir ]; then
|
|||||||
mkdir -p $cache_dir
|
mkdir -p $cache_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if sensors 'coretemp-isa-0000' &> /dev/null; then
|
||||||
|
function get_cpu_temp() {
|
||||||
|
sensors coretemp-isa-0000 | awk 'NR == 3 { print substr($4, 2) }'
|
||||||
|
}
|
||||||
|
elif sensors 'asus_wmi_sensors-virtual-0' &> /dev/null; then
|
||||||
|
function get_cpu_temp {
|
||||||
|
sensors asus_wmi_sensors-virtual-0 | grep 'CPU Temperature' | awk '{ print $3 }'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
function get_cpu_temp {
|
||||||
|
echo 'cpu temp not available'
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
# Cleanup cache file when interrupted.
|
# Cleanup cache file when interrupted.
|
||||||
trap '[ -f $cache_file ] && rm $cache_file; exit' INT
|
trap '[ -f $cache_file ] && rm $cache_file; exit' INT
|
||||||
trap '[ -f $cache_file ] && rm $cache_file; exit' TERM
|
trap '[ -f $cache_file ] && rm $cache_file; exit' TERM
|
||||||
@ -18,7 +32,7 @@ while true; do
|
|||||||
jq '.sysstat.hosts[0].statistics[0]["cpu-load"][1:]|.[].idle' | \
|
jq '.sysstat.hosts[0].statistics[0]["cpu-load"][1:]|.[].idle' | \
|
||||||
awk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 11), 1) }'`
|
awk '$idle ~ /[-.0-9]*/ { printf "%s", substr("█▇▆▅▄▃▂▁ ", int($idle / 11), 1) }'`
|
||||||
# Parse the current CPU package temperature.
|
# Parse the current CPU package temperature.
|
||||||
cpu_temp=`sensors coretemp-isa-0000 | awk 'NR == 3 { print substr($4, 2) }'`
|
cpu_temp=$(get_cpu_temp)
|
||||||
# Write to the cache file.
|
# Write to the cache file.
|
||||||
echo "$cpu_temp $cpu_load" > $cache_file
|
echo "$cpu_temp $cpu_load" > $cache_file
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user