Code: Select all
cat /usr/local/bin/checktemp
#!/bin/sh
temp=`cat /sys/class/thermal/thermal_zone0/temp`
foo=$((${temp}/1000))
bar=$((${temp}%1000))
echo ${foo}.`printf %.3d ${bar}` CCode: Select all
cat /usr/local/bin/checktemp
#!/bin/sh
temp=`cat /sys/class/thermal/thermal_zone0/temp`
foo=$((${temp}/1000))
bar=$((${temp}%1000))
echo ${foo}.`printf %.3d ${bar}` CCode: Select all
vcgencmd measure_tempCode: Select all
#!/bin/bash
temp=$(cat /sys/class/thermal/thermal_zone0/temp)
((foo = temp / 1000))
((bar = temp % 1000))
printf "%d.%.3d\302\260C\n" $foo $bar
Code: Select all
#!/bin/bash
cputemp=$(/opt/vc/bin/vcgencmd measure_temp)
echo CPU temp from vcgencmd: $cputemp
cputherm=$(cat /sys/class/thermal/thermal_zone0/temp)
ctherm=$(echo "scale=1;$cputherm/1000" | bc)
ftherm=$(echo "scale=1;(($cputherm/1000)*(9/5))+32" | bc)Code: Select all
#!/bin/bash
cputemp=$(/opt/vc/bin/vcgencmd measure_temp)
echo CPU temp from vcgencmd: $cputemp
cputherm=$(cat /sys/class/thermal/thermal_zone0/temp)
ctherm=$(echo "scale=1;$cputherm/1000" | bc)
ftherm=$(echo "scale=1;(($cputherm/1000)*(9/5))+32" | bc)
echo CPU temp from thermal_zone: $ctherm"ºC ($fthermºF)"