Set clear status if SMART is not supported
This commit is contained in:
parent
26d6b06c86
commit
3b016ae797
|
@ -3,7 +3,7 @@
|
||||||
# NOTE: Must be run as root, so you probably need to setup sudo for this.
|
# NOTE: Must be run as root, so you probably need to setup sudo for this.
|
||||||
|
|
||||||
# Vars {{{
|
# Vars {{{
|
||||||
debug="0"
|
debug="1"
|
||||||
|
|
||||||
## Colors {{{
|
## Colors {{{
|
||||||
c_redb='\033[1;31m'
|
c_redb='\033[1;31m'
|
||||||
|
@ -50,7 +50,6 @@ is_disk_support_smart() {
|
||||||
}
|
}
|
||||||
## }}}
|
## }}}
|
||||||
|
|
||||||
|
|
||||||
if test -f /tmp/dres; then rm -f /tmp/dres; fi
|
if test -f /tmp/dres; then rm -f /tmp/dres; fi
|
||||||
if test -f /tmp/dscan; then rm -f /tmp/dscan; fi
|
if test -f /tmp/dscan; then rm -f /tmp/dscan; fi
|
||||||
|
|
||||||
|
@ -64,9 +63,18 @@ while IFS= read -r LINE; do
|
||||||
|
|
||||||
is_disk_support_smart "${DISK}" "${TYPE}"
|
is_disk_support_smart "${DISK}" "${TYPE}"
|
||||||
|
|
||||||
## Get SMART Health Status and return code
|
## If SMART is supported on the disk
|
||||||
DRES=$(/usr/sbin/smartctl -H -d "${TYPE}" -n standby "${DISK}")
|
if [ -z "${smart_support_msg}" ]; then
|
||||||
DCODE=$?
|
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : SMART seems fully supported, proceed normally."
|
||||||
|
### Get SMART Health Status and return code
|
||||||
|
DRES=$(/usr/sbin/smartctl -H -d "${TYPE}" -n standby "${DISK}")
|
||||||
|
DCODE=$?
|
||||||
|
else
|
||||||
|
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : SMART is not fully supported, get ."
|
||||||
|
DRES=$(printf '%s' "${smart_support_msg}")
|
||||||
|
DCODE="2"
|
||||||
|
fi
|
||||||
|
|
||||||
DSTBY=$(( DCODE & 2 ))
|
DSTBY=$(( DCODE & 2 ))
|
||||||
DFAIL=$(( DCODE & 8 ))
|
DFAIL=$(( DCODE & 8 ))
|
||||||
DWARN=$(( DCODE & 32 ))
|
DWARN=$(( DCODE & 32 ))
|
||||||
|
|
Loading…
Reference in New Issue