From b4fd8bf2ac82eedf6a68b9e21a7a966d3851b4ff Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Mon, 15 Sep 2025 12:30:37 +0200 Subject: [PATCH] Minor fix --- scripts/daily-smart-report.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/daily-smart-report.sh b/scripts/daily-smart-report.sh index cdee6ec..a68ce45 100755 --- a/scripts/daily-smart-report.sh +++ b/scripts/daily-smart-report.sh @@ -72,7 +72,12 @@ main() { # Get SMART health local health="UNKNOWN" - if health=$(smartctl -H "$device" 2>/dev/null | grep -o "PASSED\|FAILED" | head -1); then + local smartctl_opts="" + if [[ "$is_nvme" == "true" ]]; then + smartctl_opts="-d nvme" + fi + + if health=$(smartctl $smartctl_opts -H "$device" 2>/dev/null | grep -o "PASSED\|FAILED" | head -1); then echo " Health: $health" else health="UNKNOWN" @@ -88,7 +93,7 @@ main() { if [[ "$health" == "PASSED" ]]; then local smart_data - smart_data=$(smartctl -A "$device" 2>/dev/null) + smart_data=$(smartctl $smartctl_opts -A "$device" 2>/dev/null) if [[ "$is_nvme" == "true" ]]; then # NVMe attributes (different format)