Dashboard: fix smart health detection

This commit is contained in:
bergware
2023-12-09 15:29:44 +01:00
parent 46726bfa2e
commit 7638cdac4a

View File

@@ -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"])) {