Скрипт выключения при перегреве

http://www.funtoo.org/Raspberry_Pi_Userland_(VCGENCMD)

# vi /usr/bin/tempcheck

#!/bin/sh
# This script reads the value of the SoC Broadcom temperature and turns off
# Exceeds a certain value.
# 80 ° C is the maximum allowed for a Raspberry Pi.

LOCK="/tmp/tempcheck.lock"
if [ -e ${LOCK} ]; then
        echo -e "SoC temperature check failure. Another process is in execution:\n\n"
        exit 1
fi

#####################################
# Creating LOCK
touch ${LOCK}

# Transforms the value read in integer
SENSOR="$(vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1 | cut -d '.' -f1)"
TEMP="$(printf "%.0f\n" ${SENSOR})"
# Sets supported maximum temperature
MAX="78"

if [ "${TEMP}" -gt "${MAX}" ] ; then
        # Will be sent an email to the root if executed via cron
        echo "${TEMP}єC is too hot!"
        # Logs an event in the system log
        /usr/bin/logger "Shutting down due to SoC temp ${TEMP}."
        # Halt hardware
        rm ${LOCK}
        /sbin/shutdown -h now
else
        # Remove lock
        rm ${LOCK}
        exit 0
fi


Give execute permission:
#  chmod +x /usr/bin/tempcheck


Set the Crontab to run the script every 5 minutes:
*/5 *   *   *   *    /usr/bin/tempcheck