Author: Chris Boulton (chris@bigcommerce.com)
date_default_timezone_set('Europe/London');
require __DIR__ . '/../../loadsettings.php';
$settings = loadsettings();
$REDIS_BACKEND = $settings['resque']['REDIS_BACKEND'];
if (!empty($REDIS_BACKEND)) {
    Resque::setBackend($REDIS_BACKEND);
}
$logLevel = 0;
$LOGGING = $settings['resque']['LOGGING'];
$VERBOSE = $settings['resque']['VERBOSE'];
$VVERBOSE = $settings['resque']['VVERBOSE'];
if (!empty($LOGGING) || !empty($VERBOSE)) {
    $logLevel = ResqueScheduler_Worker::LOG_NORMAL;
} else {
    if (!empty($VVERBOSE)) {
        $logLevel = ResqueScheduler_Worker::LOG_VERBOSE;
    }
}
$interval = 5;
$INTERVAL = $settings['resque']['INTERVAL'];
if (!empty($INTERVAL)) {
    $interval = $INTERVAL;
}
$worker = new ResqueScheduler_Worker();
$worker->logLevel = $logLevel;
$PIDFILE = $settings['resquescheduler']['PIDFILE'];
if ($PIDFILE) {
    file_put_contents($PIDFILE, getmypid()) or die('Could not write PID information to ' . $PIDFILE);
}
fwrite(STDOUT, '*** Starting scheduler worker ' . "\n");
$worker->work($interval);
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $worker = new \ResqueScheduler_Worker();
     $worker->logLevel = $input->getOption('log');
     $worker->work($input->getOption('interval'));
 }