Added waiting time conversion

This commit is contained in:
Jeroen De Meerleer 2019-04-27 13:37:16 +02:00
parent 5dcd8c8da5
commit 92a8cd9556
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 5 additions and 4 deletions

View File

@ -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 <pre>reboot cmd={{command}}&services={{command}}</pre> 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 <pre>reboot cmd={{command}}&services={{command}}</pre> 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 {

View File

@ -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 = '';