diff --git a/var/mongoose/html/diag/clearlog.jim b/var/mongoose/html/diag/clearlog.jim index ff4e76d1..82127702 100755 --- a/var/mongoose/html/diag/clearlog.jim +++ b/var/mongoose/html/diag/clearlog.jim @@ -9,10 +9,12 @@ set logdirs {/var/log /mod/tmp /mnt/hd3} set logext {.log} set log [cgi_get file 0] +set unlink [cgi_get unlink 0] set ldir [file dirname $log] if {[file dirname $log] in $logdirs && [file extension $log] in $logext} { file copy -force "/dev/null" $log + if {$unlink} { file delete $log } puts "Cleared $log" exit } diff --git a/var/mongoose/html/lib/header.jim b/var/mongoose/html/lib/header.jim index d826daf4..bb32109e 100755 --- a/var/mongoose/html/lib/header.jim +++ b/var/mongoose/html/lib/header.jim @@ -26,6 +26,7 @@ puts "
" source /mod/webif/include/restart.jim puts "
" source /mod/webif/include/diskcheck.jim +source /mod/webif/include/notify.jim puts {
diff --git a/var/mongoose/include/diskcheck.jim b/var/mongoose/include/diskcheck.jim index a3cba52f..5bdee59a 100755 --- a/var/mongoose/include/diskcheck.jim +++ b/var/mongoose/include/diskcheck.jim @@ -40,11 +40,13 @@ foreach sa $smartattrs { } if {$smartmsg ne ""} { + if {![dict exists $env REQUEST_URI]} { set env(REQUEST_URI) "" } puts "
!! WARNING !!

-There are some issues with the internal hard disk on this device. +There appear to be some hardware problems with the internal hard disk on +this device.

[string map {"\n" "
"} $smartmsg] " @@ -56,7 +58,7 @@ There are some issues with the internal hard disk on this device. } else { puts "
- For help and assistance, visit + Don't panic; for help and assistance, visit hummy.tv " } diff --git a/var/mongoose/include/notify.jim b/var/mongoose/include/notify.jim new file mode 100755 index 00000000..5c8a7d70 --- /dev/null +++ b/var/mongoose/include/notify.jim @@ -0,0 +1,30 @@ +#!/mod/bin/jimsh + +if {[file exists /mod/tmp/notify.log]} { + +source /mod/webif/lib/setup +require cat + +puts " +
+!! WARNING !! +

+You have pending system notifications: +

+
+"
+cat /mod/tmp/notify.log
+puts {
+
+ +
+ +} + +} + diff --git a/var/mongoose/lib/bin/auto b/var/mongoose/lib/bin/auto index 05874970..fb4a69f5 100755 --- a/var/mongoose/lib/bin/auto +++ b/var/mongoose/lib/bin/auto @@ -174,6 +174,7 @@ proc do_shrink {ts} { } } msg]} { log "Error during shrink: $msg" 0 + system notify "$file - auto-shrink - error $msg." return } @@ -348,6 +349,7 @@ proc do_mpg {ts} { } } msg]} { log "Error during mpg extract: $msg" 0 + system notify "$file - auto-mpg - error $msg." return } @@ -393,6 +395,7 @@ proc do_mp3 {ts} { } } msg]} { log "Error during mp3 extract: $msg" 0 + system notify "$file - auto-mp3 - error $msg." return } diff --git a/var/mongoose/lib/bin/diskattrs b/var/mongoose/lib/bin/diskattrs index 7918d6b5..9f36896d 100755 --- a/var/mongoose/lib/bin/diskattrs +++ b/var/mongoose/lib/bin/diskattrs @@ -38,8 +38,14 @@ if {[dict exists $attrs 5]} { } if {[dict exists $attrs 197]} { $settings _nval_setting "SMART_pending" $attrs(197) + if {$attrs(197) < [$settings _nval_setting "SMART_ack_pending"]} { + $settings _nval_setting "SMART_ack_pending" $attrs(197) + } } if {[dict exists $attrs 198]} { $settings _nval_setting "SMART_offline" $attrs(198) + if {$attrs(198) < [$settings _nval_setting "SMART_ack_offline"]} { + $settings _nval_setting "SMART_ack_offline" $attrs(198) + } } diff --git a/var/mongoose/lib/system.class b/var/mongoose/lib/system.class index c60bd247..590eb551 100644 --- a/var/mongoose/lib/system.class +++ b/var/mongoose/lib/system.class @@ -249,5 +249,10 @@ proc {system is_listening} {mport} { } proc {system notify} {msg} { + set logfd [open "/mod/tmp/notify.log" "a+"] + puts $logfd "[\ + clock format [clock seconds] -format "%d/%m/%Y %H:%M"\ + ] - $msg" + $logfd close }