Added timestamp

This commit is contained in:
Jeroen De Meerleer 2021-05-24 23:10:14 +02:00
parent 9ecf907fde
commit f8e3e6d50c
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
3 changed files with 5 additions and 5 deletions

View File

@ -49,8 +49,7 @@ class DaemonCommand extends Command
if(!empty($jobsToRun)) {
foreach($jobsToRun as $job) {
$jobRepo->setJobRunning($job, true);
$pid = -1;
//$pid = pcntl_fork();
$pid = pcntl_fork();
if($pid == -1) {
$jobRepo->RunJob($job);
$jobRepo->setJobRunning($job, false);

View File

@ -105,9 +105,9 @@ class Job
} while ($nextrun < time());
$addRunSql = 'UPDATE job SET nextrun = :nextrun WHERE id = :id';
$addRunSql = 'UPDATE job SET nextrun = :nextrun, timestamp = :timestamp WHERE id = :id';
$addRunStmt = $this->dbcon->prepare($addRunSql);
$addRunStmt->executeQuery([':id' => $job['id'], ':nextrun' => $nextrun]);
$addRunStmt->executeQuery([':id' => $job['id'], ':nextrun' => $nextrun, ':timestamp' => time()]);
}
public function addJob(array $values)
{

View File

@ -22,5 +22,6 @@ CREATE TABLE run (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
job_id INTEGER NOT NULL,
exitcode TEXT NOT NULL,
output TEXT NOT NULL
output TEXT NOT NULL,
timestamp INTEGER NOT NULL
);