BUGFIX: reboot jobs stopped after triggering initial command

This commit is contained in:
Jeroen De Meerleer 2023-01-11 13:46:19 +01:00
parent c59a84a34f
commit 12205ad18e
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 5 additions and 8 deletions

View File

@ -74,13 +74,10 @@ class DaemonCommand extends Command
$jobRepo = $this->doctrine->getRepository(Job::class);
}
if(!$async || $pid == -1) {
$jobRepo->RunJob($job, $manual);
$jobRepo->setJobRunning($job, false);
} elseif ($pid == 0) {
$jobRepo->RunJob($job, $manual);
$jobRepo->setJobRunning($job, false);
exit;
if((!$async || $pid == -1) || $pid == 0) {
$result = $jobRepo->RunJob($job, $manual);
if ($result['status'] == 'ran') $jobRepo->setJobRunning($job, false);
if ($pid == 0) exit;
}
unset($jobsToRun[$key]);
unset($job);

View File

@ -516,7 +516,7 @@ class JobRepository extends EntityRepository
$this->deleteTempVar($job);
$em->persist($job);
$em->flush();
return ['job_id' => $job->getId(), 'exitcode' => $result['exitcode'], 'timestamp' =>floor($starttime), 'runtime' => $runtime, 'output' => (string)$result['output'], 'flags' => implode("", $flags)];
return ['job_id' => $job->getId(), 'status' => 'ran', 'exitcode' => $result['exitcode'], 'timestamp' =>floor($starttime), 'runtime' => $runtime, 'output' => (string)$result['output'], 'flags' => implode("", $flags)];
}
/**