diff options
author | Britney Fransen <brfransen@gmail.com> | 2016-01-29 19:29:24 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2016-01-29 19:29:24 (GMT) |
commit | 0873cf04612494e0d385b2033f4287fa69931a4f (patch) | |
tree | 1fcc033b02a2008333c4a6a84945b291ab9c0b64 /abs/core/xymon/xymon-hddtemp.sh | |
parent | 2204ce656276d6b9776d2c99882bfe093be3808b (diff) | |
download | linhes_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/core/xymon/xymon-hddtemp.sh')
-rwxr-xr-x | abs/core/xymon/xymon-hddtemp.sh | 22 |
1 files changed, 17 insertions, 5 deletions
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 == "" ]] |