summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2016-01-29 19:29:24 (GMT)
committerBritney Fransen <brfransen@gmail.com>2016-01-29 19:29:24 (GMT)
commit0873cf04612494e0d385b2033f4287fa69931a4f (patch)
tree1fcc033b02a2008333c4a6a84945b291ab9c0b64 /abs
parent2204ce656276d6b9776d2c99882bfe093be3808b (diff)
downloadlinhes_pkgbuild-0873cf04612494e0d385b2033f4287fa69931a4f.zip
linhes_pkgbuild-0873cf04612494e0d385b2033f4287fa69931a4f.tar.gz
linhes_pkgbuild-0873cf04612494e0d385b2033f4287fa69931a4f.tar.bz2
xymon: xymon-hddtemp.sh: check for optical and mounted
check if SMART is enabled
Diffstat (limited to 'abs')
-rwxr-xr-xabs/core/xymon/PKGBUILD4
-rwxr-xr-xabs/core/xymon/xymon-hddtemp.sh22
2 files changed, 19 insertions, 7 deletions
diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
index 9de6599..b106e66 100755
--- a/abs/core/xymon/PKGBUILD
+++ b/abs/core/xymon/PKGBUILD
@@ -1,7 +1,7 @@
pkgbase=xymon
pkgname=('xymonserver' 'xymonclient')
pkgver=4.3.17
-pkgrel=21
+pkgrel=22
pkgdesc="Xymon is a system for monitoring of hosts and networks"
license="GPL"
arch=('i686' 'x86_64')
@@ -181,7 +181,7 @@ md5sums=('d8d119a777e7b7204d1292fb27314312'
'9af2ad60ac4c3cb653754618f603e311'
'313b11e7a22c3c08fb2afaadbfb46d87'
'6452d891d88bb46d07bcf7790a523ad0'
- 'f0486d82a56a0e28a20278daabbc4c53'
+ 'b49e7de696c1a0678ad198bab926266c'
'e071c387deac6b896b20db19903b7794'
'b4e8641e97e6b689dbc634af785e6799'
'e2844513e2c92e8b5084818f3b2a478d'
diff --git a/abs/core/xymon/xymon-hddtemp.sh b/abs/core/xymon/xymon-hddtemp.sh
index 6c0f109..7084abc 100755
--- a/abs/core/xymon/xymon-hddtemp.sh
+++ b/abs/core/xymon/xymon-hddtemp.sh
@@ -8,15 +8,27 @@ do
DISKDEV=`ls -l $DISK | awk -F/ '{print $NF}'`
DISKNAME=`echo $DISK | awk -F/ '{print $5}' | tr ":" "_"`
- #check if disk is removable
- RM=0
- RM=`cat /sys/block/$DISKDEV/removable`
- if test $RM -ne 0
+ #check if device is optical
+ if [[ $DISKDEV == "sr"* ]]
then
continue
fi
- hddtemp=`sudo smartctl -A $DISK | grep Temperature_Celsius | awk '{print $10}'`
+ #check if device is mounted
+ if ! mount | grep -q /dev/$DISKDEV
+ then
+ continue
+ fi
+
+ #check if SMART is disabled and enable
+ DRES=`sudo /usr/bin/smartctl -A $DISK`
+ if [[ $DRES == *"SMART Disabled. Use option -s with argument 'on'"* ]]
+ then
+ sudo /usr/bin/smartctl -s on $DISK
+ DRES=`sudo /usr/bin/smartctl -A $DISK`
+ fi
+
+ hddtemp=`echo "$DRES" | grep Temperature_Celsius | awk '{print $10}'`
TEMP=": $hddtemp"
if [[ $hddtemp == "" ]]