added uptime/load
added uptime/load

file:a/hddtemp.sh -> file:b/hddtemp.sh
--- a/hddtemp.sh
+++ b/hddtemp.sh
@@ -7,10 +7,10 @@
 
 for disk in $HDDS
 do
-  if [ -b $disk ]; then
+if [ -b $disk ]; then
 	HDTEMP=$($HDT $disk | awk '{ print $4}')
 	HDTEMP="$(echo "$HDTEMP" | sed 's/[^0-9]//g')"
-        if [ $HDTEMP -ge $ALERT_LEVEL ]; then
+	if [ $HDTEMP -ge $ALERT_LEVEL ]; then
 		$LOG "System going down as hard disk : $disk temperature $HDTEMP C crossed the limit"
 		sync;sync
 		ss="$(echo "$disk" | sed 's/[^a-z]//g')"
@@ -24,7 +24,7 @@
 	else
 		$LOG "Hard disk temperature : $disk $HDTEMP C"
 		sync;sync
-        fi
-  fi
+	fi
+fi
 done
 

file:b/uptime.sh (new)
--- /dev/null
+++ b/uptime.sh
@@ -1,1 +1,24 @@
+#!/bin/bash
+LOG=/usr/bin/logger
+ALERT_LEVEL=10
 
+LOAD=$(uptime | awk '{ print $10}')
+LOAD=$(echo "$LOAD" | sed -r 's/,//g')
+if [ "$LOAD" == "" ]; then
+	LOAD=$(uptime | awk '{ print $11}')
+	LOAD=$(echo "$LOAD" | sed -r 's/,//g')
+fi
+
+if [ $(echo "$LOAD > $ALERT_LEVEL" | bc) == 1 ]; then
+	$LOG "System load is $LOAD crossed the limit"
+	sync;sync
+	# notification method. I use boxcar.io push messages to my phone
+	#screen -dmS boxcar curl -d "email=" \
+	#-d "&notification[from_screen_name]=" \
+	#-d "&notification[message]=Load is $LOAD" \
+	#http://boxcar.io/devices/providers/hash/notifications
+else
+	$LOG "Load : $LOAD"
+	sync;sync
+fi
+

comments