aboutsummaryrefslogtreecommitdiff
path: root/temperature.sh
diff options
context:
space:
mode:
authortoni <matzeton@googlemail.com>2013-04-15 15:04:30 +0200
committertoni <matzeton@googlemail.com>2013-04-15 15:04:30 +0200
commite33b5930923a439f4c73b6dd64253578c4131420 (patch)
treef3d9d1c359603174bb75fb2394ddb33a315dcd88 /temperature.sh
initial commit
Diffstat (limited to 'temperature.sh')
-rw-r--r--temperature.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/temperature.sh b/temperature.sh
new file mode 100644
index 0000000..1ce8ca8
--- /dev/null
+++ b/temperature.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+NAME=`basename $0`
+CHIP=
+WARN_TEMP=65
+SHUT_TEMP=75
+MAIL_USER="root"
+
+CMD=`sensors $CHIP | grep -E '°C' | awk '{ print +$3 }'`
+
+i=0
+for temp in $CMD; do
+ if [ $temp -ge $WARN_TEMP ] && [ $temp -lt $SHUT_TEMP ]; then
+ echo "$0: WARNING: CPU Core heat ($temp C)" | mail -s "CPU Core WARN" $MAIL_USER
+ echo "TEMP$i HEAT ($temp C)" | logger -p user.crit -t $NAME
+ fi
+
+ if [ $temp -ge $SHUT_TEMP ]; then
+ echo "$0: EMERGENCY: CPU Core Meltdown! I'm going sleep .. ($temp C)" | mail -s "CPU Core EMERGENCY" $MAIL_USER
+ echo "TEMP$i HEAT CRITICAL -> SHUTDOWN ($temp C)" | logger -p user.emerg -t $NAME
+ /sbin/init 0
+ fi
+
+ i=`expr $i + 1`
+done
+