Initial import
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$opts = getopt("c:j:");
|
||||
|
||||
$class = null;
|
||||
$jobid = null;
|
||||
|
||||
if (array_key_exists("c", $opts)) {
|
||||
$class = $opts['c'];
|
||||
}
|
||||
|
||||
if (array_key_exists("j", $opts)) {
|
||||
$jobid = $opts['j'];
|
||||
}
|
||||
|
||||
require_once(__DIR__ . "/../app.php");
|
||||
|
||||
print("Job Runner Starting\n");
|
||||
|
||||
$running = true;
|
||||
|
||||
while ($running) {
|
||||
$job = Job::consumeNextJob($class);
|
||||
if ($job) {
|
||||
print("Executing " . $job->getJobClass() . " job " . $job->jobID() . "\n");
|
||||
try {
|
||||
$job->run();
|
||||
} catch (PDOException $e) {
|
||||
print_r($e);
|
||||
} catch (Exception $e) {
|
||||
print_r($e);
|
||||
}
|
||||
print("Job finished\n");
|
||||
} else {
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
if (file_exists("/tmp/dpr_jobrunner_quit")) {
|
||||
unlink("/tmp/dpr_jobrunner_quit");
|
||||
$running = false;
|
||||
}
|
||||
}
|
||||
|
||||
print("Job Runner Exited Cleanly\n");
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
file_put_contents("/tmp/dpr_jobrunner_quit", "");
|
||||
|
||||
Reference in New Issue
Block a user