webif/var/mongoose/cgi-bin/restart.jim

57 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require rsv.class system.class
puts "Content-Type: text/html"
puts ""
cgi_input
if {[cgi_get now] eq "yes"} {
# - Busybox reboot does sync the disk but may still not be clean enough.
puts "Restarting."
system reboot
exit
}
file delete /tmp/.restartpending
header
# Commit pending reservations on older mod versions.
if {![file exists /sbin/rsvsync] && ![file exists /mod/boot/rsvsync]} {
rsv commit
}
puts {
<link href=/css/jquery.progressbar.css rel=stylesheet type=text/css />
<script type="text/javascript" src="/js/jquery.progressbar.js"></script>
<script type=text/javascript>
var handle = 0;
var pct = 0;
function update()
{
$('#progressbar').reportprogress(++pct);
if (pct == 100)
{
clearInterval(handle);
pct = 0;
window.location = '/';
}
}
$(document).ready(function() {
$('#progressbar').reportprogress(0);
handle = setInterval("update()", 300);
$.get('/cgi-bin/restart.jim?now=yes');
});
</script>
Please wait while the Humax restarts...<br>
<div id=progressbar></div>
}
footer