diff --git a/webif/html/diag/disk.jim b/webif/html/diag/disk.jim index f6f0dc0..4dc0658 100755 --- a/webif/html/diag/disk.jim +++ b/webif/html/diag/disk.jim @@ -30,7 +30,10 @@ puts " " -foreach line [split [exec /bin/smartctl -i $device] "\n"] { +if {[catch {set msg [exec /bin/smartctl -i $device]} xmsg]} { + set msg $xmsg +} +foreach line [split $msg "\n"] { if {[string match "*Not in smartctl database*" $line]} continue if {[string match "*: *" $line]} { regsub -all -- {[[:space:]]+} $line " " line @@ -95,8 +98,11 @@ set nolife {184 187 188 189 191 197 198} set derive {4 "" 5 sectors 9 hours 12 cycles 192 "" 193 "cycles"} +if {[catch {set msg [exec /bin/smartctl -A $device]}]} { + set msg "" +} set i 0 -foreach line [split [exec /bin/smartctl -A $device] "\n"] { +foreach line [split $msg "\n"] { regsub -all -- {[[:space:]]+} $line " " line regsub -all -- {^[[:space:]]+} $line "" line if {[incr i] < 8} continue @@ -185,8 +191,8 @@ puts { } -if {[catch {set msg [exec /bin/smartctl -l selftest $device]} xmsg]} { - set msg $xmsg +if {[catch {set msg [exec /bin/smartctl -l selftest $device]}]} { + set msg "" } set i 0
SMART Status$smart