diff options
author | Britney Fransen <brfransen@gmail.com> | 2016-01-29 17:29:28 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2016-01-29 17:29:28 (GMT) |
commit | d28fa9756f4898ddccef11d97da7d40fc634f7bd (patch) | |
tree | cb2229f31345f5e936d292a2a412a663918d0660 /abs/core | |
parent | 157bdaa9b865723785c1047324843af8468849ea (diff) | |
download | linhes_pkgbuild-d28fa9756f4898ddccef11d97da7d40fc634f7bd.zip linhes_pkgbuild-d28fa9756f4898ddccef11d97da7d40fc634f7bd.tar.gz linhes_pkgbuild-d28fa9756f4898ddccef11d97da7d40fc634f7bd.tar.bz2 |
xymon: xymon-smart.sh: check for optical and mounted
check if SMART is disabled and enable
Diffstat (limited to 'abs/core')
-rwxr-xr-x | abs/core/xymon/PKGBUILD | 4 | ||||
-rwxr-xr-x | abs/core/xymon/xymon-smart.sh | 23 |
2 files changed, 20 insertions, 7 deletions
diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD index 7197a24..9de6599 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=20 +pkgrel=21 pkgdesc="Xymon is a system for monitoring of hosts and networks" license="GPL" arch=('i686' 'x86_64') @@ -182,7 +182,7 @@ md5sums=('d8d119a777e7b7204d1292fb27314312' '313b11e7a22c3c08fb2afaadbfb46d87' '6452d891d88bb46d07bcf7790a523ad0' 'f0486d82a56a0e28a20278daabbc4c53' - '9569e07936e337b06c194e0fb29e7e6b' + 'e071c387deac6b896b20db19903b7794' 'b4e8641e97e6b689dbc634af785e6799' 'e2844513e2c92e8b5084818f3b2a478d' '98e9242ae346f729b14cb195786571f2' diff --git a/abs/core/xymon/xymon-smart.sh b/abs/core/xymon/xymon-smart.sh index f951158..7c10db5 100755 --- a/abs/core/xymon/xymon-smart.sh +++ b/abs/core/xymon/xymon-smart.sh @@ -9,16 +9,29 @@ while read DISK do DISKDEV=`ls -l $DISK | awk -F/ '{print $NF}'` - #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 - DRES=`sudo /usr/sbin/smartctl -H -n standby $DISK` + #check if device is mounted + if ! mount | grep -q /dev/$DISKDEV + then + continue + fi + + DRES=`sudo /usr/bin/smartctl -H -n standby $DISK` DCODE=$? + + #check if SMART is disabled and enable + if [[ $DRES == *"SMART Disabled. Use option -s with argument 'on'"* ]] + then + sudo /usr/bin/smartctl -s on $DISK + DRES=`sudo /usr/bin/smartctl -H -n standby $DISK` + DCODE=$? + fi + DSTBY=$(( $DCODE & 2 )) DFAIL=$(( $DCODE & 8 )) DWARN=$(( $DCODE & 32 )) |