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/xymon/xymon-smart.sh | |
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/xymon/xymon-smart.sh')
-rwxr-xr-x | abs/core/xymon/xymon-smart.sh | 23 |
1 files changed, 18 insertions, 5 deletions
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 )) |