Display additionnal device info in detail

This commit is contained in:
Jeremy Gardais 2020-02-20 18:43:23 +01:00
parent 8a3c0de8e4
commit beee18371c
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 18 additions and 12 deletions

View File

@ -102,7 +102,7 @@ if test -s /tmp/dscan; then
## If no correct type was found for this device ## If no correct type was found for this device
if [ -z "${TYPE}" ]; then if [ -z "${TYPE}" ]; then
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: SMART is not fully supported." [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: SMART is not fully supported."
DRES=$(printf '%s' "${SMART_SUPPORT_MSG}") DRES=$(printf '%s' "SMART Health Status can't be determine because of:\n${SMART_SUPPORT_MSG}")
DCODE="2" DCODE="2"
TYPE="unsupported" TYPE="unsupported"
else else
@ -110,6 +110,8 @@ if test -s /tmp/dscan; then
### Get SMART Health Status and return code ### Get SMART Health Status and return code
DRES=$(/usr/sbin/smartctl -H -d "${TYPE}" -n standby "${DISK}") DRES=$(/usr/sbin/smartctl -H -d "${TYPE}" -n standby "${DISK}")
DCODE=$? DCODE=$?
DID=$(smartctl -i -d "${TYPE}" "${DISK}" | awk '/.erial .umber:/ { print $NF }')
DINFO=$(smartctl -i -d "${TYPE}" "${DISK}" | grep -v -E "^smartctl|^Copyright|^$")
fi fi
## Test health status ## Test health status
@ -131,6 +133,8 @@ if test -s /tmp/dscan; then
COLOR="3&green" COLOR="3&green"
fi fi
## Avoid duplicate device
if ! grep -q "${DID}" /tmp/dres; then
## For summary ## For summary
echo "${COLOR} $DISK ${TYPE}" echo "${COLOR} $DISK ${TYPE}"
@ -139,10 +143,12 @@ if test -s /tmp/dscan; then
echo "${COLOR} $DISK ${TYPE}" | cut -c2- echo "${COLOR} $DISK ${TYPE}" | cut -c2-
echo "" echo ""
echo "$DRES" | grep -v -E "^smartctl|^Copyright|^$|^===" echo "$DRES" | grep -v -E "^smartctl|^Copyright|^$|^==="
echo "${DINFO}"
echo "------------------------------------------------------------" echo "------------------------------------------------------------"
echo "" echo ""
echo "" echo ""
} >> /tmp/dres } >> /tmp/dres
fi
done < /tmp/dscan >> /tmp/dcheck done < /tmp/dscan >> /tmp/dcheck
# If the file is empty # If the file is empty