#!/mod/bin/jimsh source /mod/webif/lib/setup require settings.class set smartattrs {realloc pending offline} set smartattribs(SMART_status) "Unknown" foreach sa $smartattrs { set smartattribs(SMART_$sa) 0 set smartattribs(SMART_ack_$sa) 0 } foreach line [[settings] smartdata] { lassign $line x name x n x t if {$name eq "SMART_status"} { set smartattribs($name) $t } else { set smartattribs($name) $n } } # (SMART_ack_status 0 SMART_ack_pending 0 SMART_status PASSED SMART_pending 7 SMART_ack_realloc 0 SMART_ack_offline 0 SMART_realloc 0 SMART_offline 7) set smartmsg "" if {$smartattribs(SMART_status) ne "PASSED"} { append smartmsg \ "Disk overall health assessment is: $smartattribs(SMART_status)\n" } foreach sa $smartattrs { if {$smartattribs(SMART_$sa) != $smartattribs(SMART_ack_$sa)} { append smartmsg \ "Disk $sa sector count is: $smartattribs(SMART_$sa)" if {$smartattribs(SMART_ack_$sa) > 0} { append smartmsg " (was $smartattribs(SMART_ack_$sa))" } append smartmsg "\n" } } if {$smartmsg ne ""} { puts "
!! WARNING !!

There are some issues with the internal hard disk on this device.

[string map {"\n" "
"} $smartmsg] " if {$env(REQUEST_URI) ne "/diag/disk.jim"} { puts "
Go to disk diagnostics " } else { puts "
For help and assistance, visit hummy.tv " } puts "
" }