Monday, 16 June 2014

No need to install anything. Just open a terminal and execute the following command to get the temperature of your RasPi.

/opt/vc/bin/vcgencmd measure_temp

Automate the process

The below script will automatically reboot your Raspberry Pi should it reach a specified threshold (maxtemp). First of all make sure you can reboot/shutdown your raspi without linux asking you for a password.

user@user:~$ sudo visudo

Add the following to the sudoers file.

user ALL=NOPASSWD: /sbin/shutdown

The script

Save as temp.sh. Maxtemp specifies the temperature cut-off point, at which the Raspi will reboot.