Fix Motd disk temperature (#2707)

Fixes displaying of "Always°C" temperature on disks without Min/Max temperature values.
This commit is contained in:
NekoB0x 2021-03-14 17:34:32 +02:00 committed by GitHub
parent 11cc8cb5b0
commit 922f1ca49e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -158,7 +158,7 @@ function storage_info() {
storage_total=$(awk '/\// {print $(NF-4)}' <<<${StorageInfo})
if [[ -n "$(command -v smartctl)" ]]; then
DISK="${STORAGE::-1}"
storage_temp+=$(sudo smartctl -A $DISK 2> /dev/null | grep -i temperature | awk '{print $(NF-2)}')
storage_temp+=$(smartctl -l scttempsts $DISK 2> /dev/null | grep -i 'Current Temperature:' | awk '{print $(NF-1)}')
fi
fi
} # storage_info