1) { $count = $_ENV['COUNT']; } if($count > 1) { for($i = 0; $i < $count; ++$i) { $pid = pcntl_fork(); if($pid == -1) { die("Could not fork worker ".$i."\n"); } // Child, start the worker else if(!$pid) { $queues = explode(',', $_ENV['QUEUE']); $worker = new Resque_Worker($queues); $worker->logLevel = $logLevel; fwrite(STDOUT, '*** Starting worker '.$worker."\n"); $worker->work($interval); break; } } } // Start a single worker else { $queues = explode(',', $_ENV['QUEUE']); $worker = new Resque_Worker($queues); $worker->logLevel = $logLevel; fwrite(STDOUT, '*** Starting worker '.$worker."\n"); $worker->work($interval); } ?>