public function run()
    {
        if (empty($this->queues)) {
            die('Set queues var containing the list of queues to work.' . PHP_EOL);
        }

        Resque::setBackend($this->redisBackend, $this->database, $this->password);

        if ($this->count > 1) {
            for ($i = 0; $i < $this->count; ++$i) {
                $pid = pcntl_fork();
                if ($pid == -1) {
                    die('Could not fork worker ' . $i . PHP_EOL);
                } elseif (!$pid) {
                    // Child, start the worker
                    $this->_startWorker();
                    break;
                }
            }
        } else {
            if (!empty($this->pidFile)) {
                file_put_contents($this->pidFile, getmypid()) or
                    die('Could not write PID information to ' . $PIDFILE . PHP_EOL);
            }
            // Start a single worker
            $this->_startWorker();
        }
    }
public function run()
    {
        if (empty($this->queues)) {
            die('Set queues var containing the list of queues to work.' . PHP_EOL);
        }

        Resque::setBackend($this->redisBackend, $this->database, $this->password);

        if ($this->count > 1) {
            for ($i = 0; $i < $this->count; ++$i) {
                $pid = pcntl_fork();
                if ($pid == -1) {
                    die('Could not fork worker ' . $i . PHP_EOL);
                } elseif (!$pid) {
                    // Child, start the worker
                    $this->_startWorker();
                    break;
                }
            }
        } else {
            if (!empty($this->pidFile)) {
                file_put_contents($this->pidFile, getmypid()) or
                    die('Could not write PID information to ' . $PIDFILE . PHP_EOL);
            }
            // Start a single worker
            $this->_startWorker();
        }
    }
public function run ( ) { if ( empty ( $ this -> queues ) ) { die ( 'Set queues var containing the list of queues to work.' . PHP_EOL ) ; } Resque :: setBackend ( $ this -> redisBackend , $ this -> database , $ this -> password ) ; if ( $ this -> count > 1 ) { for ( $ i = 0 ; $ i < $ this -> count ; ++ $ i ) { $ pid = pcntl_fork ( ) ; if ( $ pid == - 1 ) { die ( 'Could not fork worker ' . $ i . PHP_EOL ) ; } elseif ( ! $ pid ) { // Child, start the worker $ this -> _startWorker ( ) ; break ; } } } else { if ( ! empty ( $ this -> pidFile ) ) { file_put_contents ( $ this -> pidFile , getmypid ( ) ) or die ( 'Could not write PID information to ' . $ PIDFILE . PHP_EOL ) ; } // Start a single worker $ this -> _startWorker ( ) ; } }
Run to start workers
Run to start workers