From 2935b248da7c240639659ac5de55d134a4875a2e Mon Sep 17 00:00:00 2001 From: Marcel Stangenberger Date: Sun, 18 Jun 2023 13:58:48 +0000 Subject: [PATCH] Add 'rpi-temp.sh' --- rpi-temp.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 rpi-temp.sh 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