Merge branch 'task/config-reboot-cmd'
This commit is contained in:
commit
619d0705ba
|
@ -40,8 +40,8 @@ INSERT INTO `config` (`conf`, `category`, `type`, `label`, `description`, `value
|
||||||
('dbclean.expireruns', 'Database Cleanup', 'number(0)', 'Retention', 'How many days does the database keep the runs', '30'),
|
('dbclean.expireruns', 'Database Cleanup', 'number(0)', 'Retention', 'How many days does the database keep the runs', '30'),
|
||||||
('dbclean.enabled', 'Database Cleanup', 'text', 'Enabled', 'Database cleanup enabled? (true: yes; false: no)', 'false'),
|
('dbclean.enabled', 'Database Cleanup', 'text', 'Enabled', 'Database cleanup enabled? (true: yes; false: no)', 'false'),
|
||||||
('dbclean.lastrun', 'Database Cleanup', 'hidden', 'Last run', 'Last run of database cleanup', UNIX_TIMESTAMP()),
|
('dbclean.lastrun', 'Database Cleanup', 'hidden', 'Last run', 'Last run of database cleanup', UNIX_TIMESTAMP()),
|
||||||
('jobs.reboottime', 'Jobs', 'number(0,30)', 'Reboot delay', 'Time to wait until a reboot should be finished', '5');
|
('jobs.reboottime', 'Jobs', 'number(0)', 'Reboot time', 'The amount of time in seconds for the systems to perform a reboot', '300'),
|
||||||
('jobs.rebootwait', 'Jobs', 'number(0,30)', 'Reboot delay', 'The amount of delay in minutes between scheduling a reboot and the actual reboot', '5');
|
('jobs.rebootwait', 'Jobs', 'number(0)', 'Reboot wait', 'The amount of time in seconds between scheduling a reboot and the actual reboot', '300'),
|
||||||
('master.crashtimeout', 'Master script', 'number()', 'Master script crash timeout', 'The amount of time in seconds after we can assume the master script is crashed', '3600');
|
('master.crashtimeout', 'Master script', 'number()', 'Master script crash timeout', 'The amount of time in seconds after we can assume the master script is crashed', '3600');
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
11
js/site.js
11
js/site.js
|
@ -46,11 +46,16 @@ $(document).ready(function() {
|
||||||
$('#resultmodal').modal('show');
|
$('#resultmodal').modal('show');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$("body").on("focusout", "input[name=url]", function() {
|
$("body").on("input", "input[name=url]", function() {
|
||||||
if($("input[name=url]").val().startsWith("reboot") !== -1) {
|
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");
|
||||||
$("label[for=expected]").html("Capture services after reboot? (1: yes; 0: no)");
|
$("label[for=expected]").html("Capture services after reboot? (1: yes; 0: no)");
|
||||||
$("input[name=expected]").attr("placeholder", "1");
|
$("input[name=expected]").attr("placeholder", "1");
|
||||||
|
} else {
|
||||||
|
$("#url-description").html("");
|
||||||
|
$("label[for=expected]").html("Expected exit code");
|
||||||
|
$("input[name=expected]").attr("placeholder", "200");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("input[name=url]").focusout();
|
$("input[name=url]").trigger("input");
|
||||||
});
|
});
|
|
@ -23,6 +23,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="url">url</label>
|
<label for="url">url</label>
|
||||||
<input type="text" name="url" class="form-control" id="url" placeholder="http://example.com/ or 'sudo yum update -y'">
|
<input type="text" name="url" class="form-control" id="url" placeholder="http://example.com/ or 'sudo yum update -y'">
|
||||||
|
<p class="url-description"></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="url">url</label>
|
<label for="url">url</label>
|
||||||
<input type="text" name="url" class="form-control" id="url" placeholder="http://example.com/ or 'sudo yum update -y'" value="{{ url }}">
|
<input type="text" name="url" class="form-control" id="url" placeholder="http://example.com/ or 'sudo yum update -y'" value="{{ url }}">
|
||||||
|
<p class="url-description"></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
@ -132,8 +132,10 @@ if(file_exists("cache/reboot.trigger")) {
|
||||||
$cmd = $rebootcommands['cmd'];
|
$cmd = $rebootcommands['cmd'];
|
||||||
|
|
||||||
if ($cmd == '') {
|
if ($cmd == '') {
|
||||||
$cmd = 'sudo shutdown -r +' . get_configvalue('jobs.rebootwait') . ' "A reboot has been scheduled. Please save your work."';
|
$cmd = 'sudo shutdown -r -t{}+ "A reboot has been scheduled. Please save your work."';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cmd = str_replace("{}+", get_configvalue('jobs.rebootwait'), $cmd);
|
||||||
$url = "ssh " . $job['host'] . " '" . $cmd . "'";
|
$url = "ssh " . $job['host'] . " '" . $cmd . "'";
|
||||||
exec($url);
|
exec($url);
|
||||||
$cmd = '';
|
$cmd = '';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user