Added reboot jobs
This commit is contained in:
parent
1ea40525f9
commit
35f73d9d6e
|
@ -70,6 +70,22 @@ class Job
|
|||
}
|
||||
$data['command'] = $values['command'];
|
||||
break;
|
||||
case 'reboot':
|
||||
$data['reboot-command'] = $values['reboot-command'];
|
||||
$data['getservices-command'] = $values['getservices-command'];
|
||||
$data['reboot-duration'] = $values['reboot-duration'];
|
||||
if(!empty($values['reboot-delay'])) {
|
||||
$newsecretkey = count($values['var-value']);
|
||||
$values['var-id'][$newsecretkey] = 'reboot-delay';
|
||||
$values['var-issecret'][$newsecretkey] = false;
|
||||
$values['var-value'][$newsecretkey] = (int)$values['reboot-delay'];
|
||||
|
||||
$newsecretkey = count($values['var-value']);
|
||||
$values['var-id'][$newsecretkey] = 'reboot-delay-secs';
|
||||
$values['var-issecret'][$newsecretkey] = false;
|
||||
$values['var-value'][$newsecretkey] = (int)$values['reboot-delay'] * 60;
|
||||
}
|
||||
break;
|
||||
case 'http':
|
||||
$parsedUrl = parse_url($values['url']);
|
||||
$data['url'] = $values['url'];
|
||||
|
@ -90,7 +106,7 @@ class Job
|
|||
if(!empty($values['var-value'])) {
|
||||
foreach($values['var-value'] as $key => $name) {
|
||||
if(!empty($name)) {
|
||||
if(isset($values['var-issecret'][$key])) {
|
||||
if(isset($values['var-issecret'][$key]) && $values['var-issecret'][$key] != false) {
|
||||
$data['vars'][$values['var-id'][$key]]['issecret'] = true;
|
||||
$data['vars'][$values['var-id'][$key]]['value'] = base64_encode(Secret::encrypt($values['var-value'][$key]));
|
||||
} else {
|
||||
|
|
|
@ -95,6 +95,31 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="crontype-reboot crontype-inputs hidden">
|
||||
<div class="mb-3">
|
||||
<label for="reboot-command">Reboot command</label>
|
||||
<input type="text" name="reboot-command" class="form-control" id="command" placeholder="systemctl reboot">
|
||||
<small id="reboot-command-help" class="form-text text-muted">Use {reboot-delay} or {reboot-delay-secs} to add the delay in your command</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="getservices-command">Get services command</label>
|
||||
<input type="text" name="getservices-command" class="form-control" id="command" placeholder="systemctl list-units">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="reboot-delay">Reboot delay (in minutes)</label>
|
||||
<input type="number" name="reboot-delay" class="form-control" placeholder="5">
|
||||
<small id="reboot-delay-help" class="form-text text-muted">Delay between triggering reboot and actual reboot</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="reboot-duration">Reboot duration (in minutes)</label>
|
||||
<input type="number" name="reboot-duration" class="form-control" placeholder="10">
|
||||
<small id="reboot-duration-help" class="form-text text-muted">The amount of time the system takes to actually reboot</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="crontype-http crontype-inputs hidden">
|
||||
<div class="mb-3">
|
||||
<label for="url">Url</label>
|
||||
|
|
Loading…
Reference in New Issue