From 6cef3f98f980e52687095c74b040cf5531688545 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Sat, 28 Sep 2013 13:57:29 -0500
Subject: LinHES-system: diskspace.sh: add OSD warnings for /home and
 /data/srv/mysql

---
 abs/core/LinHES-system/PKGBUILD      |  6 +++---
 abs/core/LinHES-system/diskspace.sh  | 17 +++++++----------
 abs/core/LinHES-system/msg_daemon.py |  4 ++--
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 098c17f..3cce3eb 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=8.0
-pkgrel=25
+pkgrel=26
 arch=('i686' 'x86_64')
 install=system.install
 pkgdesc="Everything that makes LinHES an automated system"
@@ -95,13 +95,13 @@ md5sums=('5ee78704cab0e88ec58d1aab821fc1aa'
          '1be1d3dfc83f828eede93055713882ae'
          '47e093e8cfe4b5b96602358e1f540832'
          'a8e486f5d23913242b6edb862bf44c0e'
-         '7bd8c0e96631be95086621b1d818aa95'
+         '2c005d95312018bef80092136f80f254'
          '6519d209e151cdc39ae7e1091d189c3e'
          '8f474e019d5fcb775497aca355d61b0b'
          '4a3cd8f9b33b2b86fdba47a8f1fa2859'
          '16f079dab35dde6efd55bf6cf4e2fb2f'
          '3e60b17892e5b8214d47dcfddf5215a4'
-         'fd765fc7ee640221ed4801b4a629365f'
+         '28d2fbad517bcd2ba0cb0ce09f99bf62'
          'ea315f41dcd6c978e546c95fc05546cf'
          'ac61cc460d9e97ba1f5ef69e92cdfbe5'
          'f3502bb7c665750da0ecdf6918f7c838'
diff --git a/abs/core/LinHES-system/diskspace.sh b/abs/core/LinHES-system/diskspace.sh
index d27221a..5b41b73 100755
--- a/abs/core/LinHES-system/diskspace.sh
+++ b/abs/core/LinHES-system/diskspace.sh
@@ -5,7 +5,8 @@
 #
 # Static Config Variables
 #
-ALERT=90                        # free space percentage to trigger an alert
+# free space percentage to trigger an alert
+ALERT=90
 
 #
 # Static Binary Paths
@@ -17,7 +18,7 @@ CUT='/usr/bin/cut'
 HOSTNAME='/usr/bin/hostname'
 DATE='/bin/date'
 MSG_CLIENT='/usr/LH/bin/msg_client.py --msg'
-export DISPLAY=:0.0
+
 #
 # Static System Variables
 #
@@ -53,16 +54,12 @@ $DF -HPl | $GREP -E "^/dev/" | $AWK '{ print $5 " " $6 " " $1 }' | while read OU
     PARTITION=$(echo ${OUTPUT} | $AWK '{ print $2 }' )                      # Mount Point (eg, /home)
     DEVICE=$(echo ${OUTPUT} | $AWK '{ print $3 }' )                         # Device (eg, /dev/sda1 or LABEL or UUID)
     if [ $VERBOSE = true ] ; then
-        echo -e "Checking device ${DEVICE} which is mounted to ${PARTITION} \t${USED_PCENT}% used"
+        echo -e "${USED_PCENT}% used:\tDevice ${DEVICE} mounted to ${PARTITION}"
     fi
     if [ ${USED_PCENT} -ge $ALERT ]; then
-        if [ $VERBOSE = true ] ; then
-            echo "WARNING: ${PARTITION} (${DEVICE}) is ${USED_PCENT}% full on ${THIS_HOST}."
-        else
-            echo "WARNING: ${PARTITION} (${DEVICE}) is ${USED_PCENT}% full on ${THIS_HOST}." #|
-            if [ $OSD = true ] && [ ${PARTITION} = / ]; then
-                $MSG_CLIENT "WARNING: The root (${PARTITION}) partition is ${USED_PCENT}% full on ${THIS_HOST}."
-            fi
+        echo "WARNING: Partition (${PARTITION}) on (${DEVICE}) is ${USED_PCENT}% full on ${THIS_HOST}"
+        if [ $OSD = true ] && { [ ${PARTITION} = / ] || [ ${PARTITION} = /home ] || [ ${PARTITION} = /data/srv/mysql ]; } then
+            $MSG_CLIENT "WARNING: Partition (${PARTITION}) on (${DEVICE}) is ${USED_PCENT}% full"
         fi
     fi
 done
diff --git a/abs/core/LinHES-system/msg_daemon.py b/abs/core/LinHES-system/msg_daemon.py
index 1a855bc..861dbe3 100755
--- a/abs/core/LinHES-system/msg_daemon.py
+++ b/abs/core/LinHES-system/msg_daemon.py
@@ -31,7 +31,7 @@ class msg_aosd():
         x -= 1
 
         if pos < 3:   #top positions 0 to 2
-            y -= height - 1 - ypad;
+            y -= height - ypad;
             for i in range(1, height + 1, step):
                 osd.loop_for(5)
                 y += step
@@ -48,7 +48,7 @@ class msg_aosd():
                 osd.loop_for(1);
 
         else:    #bottom positions 3 to 8
-            y += height + 1 - ypad;
+            y += height - ypad;
             for i in range(1, height + 1, step):
                 osd.loop_for(5)
                 y -= step
-- 
cgit v0.12

