diff --git a/rpi-temp.sh b/rpi-temp.sh new file mode 100644 index 0000000..d2da122 --- /dev/null +++ b/rpi-temp.sh @@ -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 \ No newline at end of file