git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1519 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2013-04-03 23:50:25 +00:00
parent 232546feef
commit a1e45d5e9c
7 changed files with 51 additions and 2 deletions

View File

@ -9,10 +9,12 @@ set logdirs {/var/log /mod/tmp /mnt/hd3}
set logext {.log} set logext {.log}
set log [cgi_get file 0] set log [cgi_get file 0]
set unlink [cgi_get unlink 0]
set ldir [file dirname $log] set ldir [file dirname $log]
if {[file dirname $log] in $logdirs && [file extension $log] in $logext} { if {[file dirname $log] in $logdirs && [file extension $log] in $logext} {
file copy -force "/dev/null" $log file copy -force "/dev/null" $log
if {$unlink} { file delete $log }
puts "Cleared $log" puts "Cleared $log"
exit exit
} }

View File

@ -26,6 +26,7 @@ puts "<div id=restart_block>"
source /mod/webif/include/restart.jim source /mod/webif/include/restart.jim
puts "</div>" puts "</div>"
source /mod/webif/include/diskcheck.jim source /mod/webif/include/diskcheck.jim
source /mod/webif/include/notify.jim
puts { puts {
<div style="clear: both"> <div style="clear: both">

View File

@ -40,11 +40,13 @@ foreach sa $smartattrs {
} }
if {$smartmsg ne ""} { if {$smartmsg ne ""} {
if {![dict exists $env REQUEST_URI]} { set env(REQUEST_URI) "" }
puts " puts "
<div id=smartwarning class=warningbox><center> <div id=smartwarning class=warningbox><center>
!! WARNING !! !! WARNING !!
<br><br> <br><br>
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.
<br><br> <br><br>
[string map {"\n" "<br>"} $smartmsg] [string map {"\n" "<br>"} $smartmsg]
" "
@ -56,7 +58,7 @@ There are some issues with the internal hard disk on this device.
} else { } else {
puts " puts "
<br> <br>
For help and assistance, visit Don't panic; for help and assistance, visit
<a target=_blank href=http://hummy.tv/>hummy.tv</a> <a target=_blank href=http://hummy.tv/>hummy.tv</a>
" "
} }

30
var/mongoose/include/notify.jim Executable file
View File

@ -0,0 +1,30 @@
#!/mod/bin/jimsh
if {[file exists /mod/tmp/notify.log]} {
source /mod/webif/lib/setup
require cat
puts "
<div id=sysnotify class=warningbox><center>
!! WARNING !!
<br><br>
You have pending system notifications:
<br><br>
<pre>
"
cat /mod/tmp/notify.log
puts {
</pre>
<button id=sysnotify_ack>Acknowledge</button>
</center></div>
<script type=text/javascript>
$('#sysnotify_ack').button().on('click', function() {
$('#sysnotify').slideUp('slow');
$.get('/diag/clearlog.jim?file=/mod/tmp/notify.log&unlink=1');
});
</script>
}
}

View File

@ -174,6 +174,7 @@ proc do_shrink {ts} {
} }
} msg]} { } msg]} {
log "Error during shrink: $msg" 0 log "Error during shrink: $msg" 0
system notify "$file - auto-shrink - error $msg."
return return
} }
@ -348,6 +349,7 @@ proc do_mpg {ts} {
} }
} msg]} { } msg]} {
log "Error during mpg extract: $msg" 0 log "Error during mpg extract: $msg" 0
system notify "$file - auto-mpg - error $msg."
return return
} }
@ -393,6 +395,7 @@ proc do_mp3 {ts} {
} }
} msg]} { } msg]} {
log "Error during mp3 extract: $msg" 0 log "Error during mp3 extract: $msg" 0
system notify "$file - auto-mp3 - error $msg."
return return
} }

View File

@ -38,8 +38,14 @@ if {[dict exists $attrs 5]} {
} }
if {[dict exists $attrs 197]} { if {[dict exists $attrs 197]} {
$settings _nval_setting "SMART_pending" $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]} { if {[dict exists $attrs 198]} {
$settings _nval_setting "SMART_offline" $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)
}
} }

View File

@ -249,5 +249,10 @@ proc {system is_listening} {mport} {
} }
proc {system notify} {msg} { 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
} }