diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/phinde-worker.php | 9 | ||||
| -rwxr-xr-x | bin/stop-worker.php | 12 |
2 files changed, 21 insertions, 0 deletions
diff --git a/bin/phinde-worker.php b/bin/phinde-worker.php index 1e94535..9f8c35a 100755 --- a/bin/phinde-worker.php +++ b/bin/phinde-worker.php @@ -23,6 +23,15 @@ $gmworker->addFunction( } ); +$gmworker->addFunction( + $GLOBALS['phinde']['queuePrefix'] . 'phinde_quit', + function(\GearmanJob $job) { + echo "Got exit job\n"; + $job->sendComplete(''); + exit(0); + } +); + while ($gmworker->work()) { if ($gmworker->returnCode() != GEARMAN_SUCCESS) { echo 'Error running job: ' . $gmworker->returnCode() . "\n"; diff --git a/bin/stop-worker.php b/bin/stop-worker.php new file mode 100755 index 0000000..48a2fe1 --- /dev/null +++ b/bin/stop-worker.php @@ -0,0 +1,12 @@ +#!/usr/bin/env php +<?php +//stop a single running worker +namespace phinde; +require_once __DIR__ . '/../src/init.php'; + +$gmclient = new \GearmanClient(); +$gmclient->addServer('127.0.0.1'); +$gmclient->doHigh( + $GLOBALS['phinde']['queuePrefix'] . 'phinde_quit', 'none' +); +?> |
