<?php include __DIR__ . '/../vendor/autoload.php'; use Processman\Driver\Pdo\Json; use Processman\Driver\Pdo\Raw; $pdo = new \PDO("mysql:queue_test;host=localhost", 'root', 'password'); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $constraint = array('server_id' => 1); $resqueman = new Processman\Processman(new Raw($pdo, 'queue_test.config_workers', $constraint), new Json($pdo, 'queue_test.running_workers', $constraint)); $resqueman->run();
<?php include __DIR__ . '/../vendor/autoload.php'; use Processman\Driver\File\Json; use Processman\Driver\File\Text; $resqueman = new Processman\Processman(new Text(__DIR__ . '/resqueman.conf'), new Json(__DIR__ . '/pid.json')); switch ($_SERVER['argv'][1]) { case 'run': $resqueman->run(); break; case 'list': echo PHP_EOL; foreach ($resqueman->listRunning() as $pid => $running) { echo PHP_EOL . "\t" . $pid . "\t\t " . $running . PHP_EOL; } echo PHP_EOL; break; case 'add': $resqueman->addCommand($_SERVER['argv'][2]); break; case 'remove': $resqueman->removeCommand($_SERVER['argv'][2]); break; }