Add 'rpi-temp.sh'

This commit is contained in:
Marcel Stangenberger 2023-06-18 13:58:48 +00:00
parent a809e504af
commit 2935b248da

23
rpi-temp.sh Normal file
View File

@ -0,0 +1,23 @@
#!/bin/bash
ALERT=0
CORE=1
SENSORS=/usr/bin/sensors
for N in `$SENSORS|grep Core|cut -f 2 -d "+" | cut -f 1 -d "."`
do
if [ $N -gt "80" ];
then
echo "ALERT: CPU core $CORE temperature to high, $N degrees Celcius"
ALERT=1
else
echo "OK: CPU core $CORE Temperature $N degrees Celcius"
fi
CORE=$((CORE+1))
done
if [ $ALERT -eq "1" ];
then
exit 2
else
exit 0
fi