2019-10-25 19:54:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
|
|
|
## ##
|
|
|
|
## A script to find and return the CPU package temp sensor ##
|
|
|
|
###############################################################################
|
|
|
|
# bash.sh
|
|
|
|
|
|
|
|
for i in /sys/class/hwmon/hwmon*/temp*_input; do
|
|
|
|
sensors+=("$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)");
|
|
|
|
done
|
|
|
|
|
|
|
|
for i in "${sensors[@]}"
|
|
|
|
do
|
|
|
|
if [[ $i =~ ^coretemp:.Package.* ]]
|
|
|
|
then
|
|
|
|
export CPU_SENSOR=${i#*0}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-10-25 21:00:15 +00:00
|
|
|
echo "scale=2;((9/5) * $(cat $CPU_SENSOR)/1000) + 32"|bc
|
2019-10-25 19:54:49 +00:00
|
|
|
|