mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Add PIDFILE environment variable to write the PID of a single running worker out to a file
This commit is contained in:
parent
0372a27ab7
commit
34de8e4307
1 changed files with 8 additions and 1 deletions
|
@ -5,7 +5,7 @@ if(empty($QUEUE)) {
|
|||
}
|
||||
|
||||
$APP_INCLUDE = getenv('APP_INCLUDE');
|
||||
if(!$APP_INCLUDE) {
|
||||
if($APP_INCLUDE) {
|
||||
if(!file_exists($APP_INCLUDE)) {
|
||||
die('APP_INCLUDE ('.$APP_INCLUDE.") does not exist.\n");
|
||||
}
|
||||
|
@ -66,6 +66,13 @@ else {
|
|||
$queues = explode(',', $QUEUE);
|
||||
$worker = new Resque_Worker($queues);
|
||||
$worker->logLevel = $logLevel;
|
||||
|
||||
$PIDFILE = getenv('PIDFILE');
|
||||
if ($PIDFILE) {
|
||||
file_put_contents($PIDFILE, getmypid()) or
|
||||
die('Could not write PID information to ' . $PIDFILE);
|
||||
}
|
||||
|
||||
fwrite(STDOUT, '*** Starting worker '.$worker."\n");
|
||||
$worker->work($interval);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue