Raspberry Pi - Controlando a temperatura do Raspberry Pi
De Área31 Hackerspace
Controlando a temperatura do Raspberry Pi
Por questões de segurança, adicione um script que irá verificar a temperatura a cada 5 minutos e desligar o Raspberry Pi caso exceda 78ºC.
vi /usr/bin/tempcheck
#!/bin/sh # This script reads the Broadcom SoC temperature value and shuts down if it # exceeds a particular value. # 80ºC is the maximum allowed for a Raspberry Pi. # Get the reading from the sensor and strip the non-number parts SENSOR="$(vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1)" # -gt only deals with whole numbers, so round it. TEMP="$(printf "%.0f\n" ${SENSOR})" # How hot will we allow the SoC to get? MAX="78" if [ "${TEMP}" -gt "${MAX}" ] ; then # This will be mailed to root if called from cron echo "${TEMP}ºC is too hot!" # Send a message to syslog /usr/bin/logger "Shutting down due to SoC temp ${TEMP}." # Halt the box /sbin/shutdown -h now else exit 0 fi
Dê permissão de execução:
chmod +x /usr/bin/tempcheck
Configure o Crontab para executar o script a cada 5 minutos:
*/5 * * * * /usr/bin/tempcheck