From 7638cdac4a9b7b90fabc6441dbcd8d2bf1a136b2 Mon Sep 17 00:00:00 2001 From: bergware Date: Sat, 9 Dec 2023 15:29:44 +0100 Subject: [PATCH] Dashboard: fix smart health detection --- emhttp/plugins/dynamix/nchan/update_2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix/nchan/update_2 b/emhttp/plugins/dynamix/nchan/update_2 index 2ff62adbd..849b6422a 100755 --- a/emhttp/plugins/dynamix/nchan/update_2 +++ b/emhttp/plugins/dynamix/nchan/update_2 @@ -192,7 +192,8 @@ function device_smart(&$disk, &$fail, &$smart) { $text = _('healthy'); $color = 'green'; $file = "state/smart/$name"; - if (file_exists("$file") && exec("grep -Pom1 '^SMART.*: \K[A-Z]+' ".escapeshellarg($file)." |tr -d '\n' 2>/dev/null", $ssa) && in_array("$ssa",$failed)) { + $ssa = file_exists($file) ? exec("grep -Pom1 '^SMART.+: \K[A-Z]+' ".escapeshellarg($file)) : ""; + if (in_array($ssa,$failed)) { $title = _('SMART health-check failed')."\n"; $thumb = 'thumbs-o-down'; $color = 'red'; $text = 'fail'; $fail++; } else { if (empty($saved["smart"]["$named.ack"])) {