cpu-temp

#!/bin/bash
# set -x;

# VARIABLES
TEMPERATUR1="60";  # (crit = +119.0°C)
TEMPERATUR2="60";  # (crit = +119.0°C)
TEMPERATUR3="60";  # (high = +80.0°C, crit = +100.0°C)
TEMPERATUR4="60";  # (high = +80.0°C, crit = +100.0°C)
TEMPERATUR5="60";  # (high = +80.0°C, crit = +100.0°C)
TEMPERATUR6="60";  # (high = +80.0°C, crit = +100.0°C)


# CPU Temperature Report

# Get info on Temperatures
STATUS_TMP1=$(sensors | awk 'FNR == 3 {print $2}');
STATUS_TMP1=${STATUS_TMP1%.*};
STATUS_TMP1=${STATUS_TMP1:1};

STATUS_TMP2=$(sensors | awk 'FNR == 4 {print $2}');
STATUS_TMP2=${STATUS_TMP2%.*};
STATUS_TMP2=${STATUS_TMP2:1};

STATUS_TMP3=$(sensors | awk 'FNR == 8 {print $4}');
STATUS_TMP3=${STATUS_TMP3%.*};
STATUS_TMP3=${STATUS_TMP3:1};

STATUS_TMP4=$(sensors | awk 'FNR == 9 {print $3}');
STATUS_TMP4=${STATUS_TMP4%.*};
STATUS_TMP4=${STATUS_TMP4:1};

STATUS_TMP5=$(sensors | awk 'FNR == 10 {print $3}');
STATUS_TMP5=${STATUS_TMP5%.*};
STATUS_TMP5=${STATUS_TMP5:1};

MESSAGE=$(sensors);
echo "${MESSAGE}";


# Check the status and set return-code
if [ "${STATUS_TMP1}" -gt "${TEMPERATUR1}" ] || [ "${STATUS_TMP2}" -gt "${TEMPERATUR2}" ] || [ "${STATUS_TMP3}" -gt "${TEMPERATUR3}" ] || [ "${STATUS_TMP4}" -gt "${TEMPERATUR4}" ] || [ "${STATUS_TMP5}" -gt "${TEMPERATUR5}" ];
then
        # TEMPERATURE must be not OK - ERROR!
        exit 1;
fi
exit 0;