forked from hummypkg/webif
Handle errors from Smartctl
This commit is contained in:
parent
c1cd90d159
commit
facd6beee4
|
@ -30,7 +30,10 @@ puts "
|
||||||
<table>
|
<table>
|
||||||
<tr><th class=key>SMART Status</th><td>$smart<td></tr>
|
<tr><th class=key>SMART Status</th><td>$smart<td></tr>
|
||||||
"
|
"
|
||||||
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 "*Not in smartctl database*" $line]} continue
|
||||||
if {[string match "*: *" $line]} {
|
if {[string match "*: *" $line]} {
|
||||||
regsub -all -- {[[:space:]]+} $line " " 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"}
|
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
|
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
|
||||||
regsub -all -- {^[[:space:]]+} $line "" line
|
regsub -all -- {^[[:space:]]+} $line "" line
|
||||||
if {[incr i] < 8} continue
|
if {[incr i] < 8} continue
|
||||||
|
@ -185,8 +191,8 @@ puts {
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|
||||||
if {[catch {set msg [exec /bin/smartctl -l selftest $device]} xmsg]} {
|
if {[catch {set msg [exec /bin/smartctl -l selftest $device]}]} {
|
||||||
set msg $xmsg
|
set msg ""
|
||||||
}
|
}
|
||||||
|
|
||||||
set i 0
|
set i 0
|
||||||
|
|
Loading…
Reference in New Issue