diff options
author | Simon Rettberg | 2019-02-06 12:35:35 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-02-06 12:35:35 +0100 |
commit | 0a43024b111ef68c10ba0fa607a90d0d19f554d4 (patch) | |
tree | 1cbe12ead1cc1480e7709d9b5949a93c24675d8a /core/modules/hardware-stats | |
parent | commitmsg-hook: Simplify filename parsing (diff) | |
download | mltk-0a43024b111ef68c10ba0fa607a90d0d19f554d4.tar.gz mltk-0a43024b111ef68c10ba0fa607a90d0d19f554d4.tar.xz mltk-0a43024b111ef68c10ba0fa607a90d0d19f554d4.zip |
[hardware-stats] Fix smartctl not reporting if HDD has issues
Diffstat (limited to 'core/modules/hardware-stats')
-rwxr-xr-x | core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats index f7cee792..1b319faa 100755 --- a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats +++ b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats @@ -186,7 +186,10 @@ if which smartctl; then [ -z "$FILE" ] && FILE="/tmp/smartctl.$$.$RANDOM.$RANDOM" for dev in $(cat "$FDISK" | grep -o '^Disk /dev/\S*:' | cut -c 6-); do dev=${dev:0:-1} - smartctl -i -H -A -f "brief" "$dev" > "$FILE" || continue + smartctl -i -H -A -f "brief" "$dev" > "$FILE" + # Exit code might be nonzero to indicate fail status, or because some (but not all) ATA commands + # failed. So instead, see if we at least got basic device information and go on if so. + grep -q -E -e '^Device Model:' -e '^\s*5\s.+\s.+\s.+\s[0-9]' "$FILE" || continue echo "NEXTHDD=$dev" >> "$ALLSMART" cat "$FILE" >> "$ALLSMART" # parse |