User Tools

Site Tools


pages:scripts:cpu-temp

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;

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
pages/scripts/cpu-temp.txt · Last modified: 2022/12/31 00:09 by Heiko Mischer