Tuesday, August 26, 2014

Shell script to check Raspberry Pi temperature

The following command print the Raspberry Pi CPU temperature:

$ cat /sys/class/thermal/thermal_zone0/temp

Shell script, chktemp.sh, with the following content print the CPU temperature:

temp=$(cat /sys/class/thermal/thermal_zone0/temp)
echo CPU Temp.= $(($temp/1000)) C

To make it executable:

$ sudo chmod +x chktemp.sh

Run it:

$ ./chktemp.sh

No comments: