diff --git a/js/site.js b/js/site.js index 1ede0c0..ed28c12 100644 --- a/js/site.js +++ b/js/site.js @@ -48,7 +48,7 @@ $(document).ready(function() { }); $("body").on("input", "input[name=url]", function() { if($("input[name=url]").val().startsWith("reboot")) { - $("#url-description").html("This job triggers a reboot. Please use
reboot cmd={{command}}&services={{command}}
to modify the reboot and get services commands. You can use {}+ in the reboot command to use the Reboot wait configuration value"); + $("#url-description").html("This job triggers a reboot. Please use
reboot cmd={{command}}&services={{command}}
to modify the reboot and get services commands. You can use {s}+ or {m}+ in the reboot command to use the Reboot wait configuration value ({s}+ will convert to seconds, {m}+ to minutes)"); $("label[for=expected]").html("Capture services after reboot? (1: yes; 0: no)"); $("input[name=expected]").attr("placeholder", "1"); } else { diff --git a/webcron.php b/webcron.php index b125fdd..29a56fe 100644 --- a/webcron.php +++ b/webcron.php @@ -140,11 +140,12 @@ if(file_exists("cache/reboot.trigger")) { $cmd = $rebootcommands['cmd']; if ($cmd == '') { - $cmd = 'sudo shutdown -r +{}+ "A reboot has been scheduled. Please save your work."'; - $cmd = str_replace("{}+", intdiv(get_configvalue('jobs.rebootwait'), 60), $cmd); + $cmd = 'sudo shutdown -r +{m}+ "A reboot has been scheduled. Please save your work."'; } - $cmd = str_replace("{}+", get_configvalue('jobs.rebootwait'), $cmd); + $cmd = str_replace("{m}+", intdiv(get_configvalue('jobs.rebootwait'), 60), $cmd); + $cmd = str_replace("{s}+", get_configvalue('jobs.rebootwait'), $cmd); + $url = "ssh " . $job['host'] . " '" . $cmd . " &'"; exec($url); $cmd = '';