BUGFIX: when rebooting via cli one could possibly not recover
This commit is contained in:
parent
f8c89230b7
commit
f49e9e06a7
|
@ -49,7 +49,14 @@ class DaemonCommand extends Command
|
|||
$jobsToRun = $jobRepo->getJobsDue();
|
||||
if(!empty($jobsToRun)) {
|
||||
foreach($jobsToRun as $job) {
|
||||
if($jobRepo->getTempVar($job['id'], 'consolerun')) continue;
|
||||
$jobObj = $jobRepo->getJob($job['id']);
|
||||
if($jobObj['data']['crontype'] == 'reboot') {
|
||||
$str = @file_get_contents('/proc/uptime');
|
||||
$num = floatval($str);
|
||||
$rebootedself = ($num < $jobObj['data']['reboot-duration'] * 60);
|
||||
$consolerun = $jobRepo->getTempVar($job['id'], 'consolerun');
|
||||
if($consolerun && !$rebootedself) continue;
|
||||
}
|
||||
$jobRepo->setJobRunning($job['id'], true);
|
||||
$output->writeln('Running Job ' . $job['id']);
|
||||
declare(ticks = 1);
|
||||
|
|
|
@ -56,7 +56,7 @@ class RunCommand extends Command
|
|||
$jobRepo->setTempVar($jobId, 'consolerun', false);
|
||||
$output->write($result['output']);
|
||||
if($result['success']) {
|
||||
$output->writeln('Job succeeded with in ' . number_format($result['runtime'], 3) . 'secs exitcode ' . $result['exitcode']);
|
||||
$output->writeln('Job succeeded with in ' . number_format($result['runtime'], 3) . 'secs with exitcode ' . $result['exitcode']);
|
||||
return Command::SUCCESS;
|
||||
} else {
|
||||
$output->writeln('Job failed in ' . number_format($result['runtime'], 3) . 'secs with exitcode ' . $result['exitcode']);
|
||||
|
|
Loading…
Reference in New Issue