123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- define('INSTALLDIR', dirname(__DIR__));
- define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
- $shortoptions = 'ur';
- $longoptions = array('update', 'restart', 'stop');
- $helptext = <<<END_OF_QUEUECTL_HELP
- Send broadcast events to control any running queue handlers.
- (Currently for Stomp queues only.)
- Events relating to current site (as selected with -s etc)
- -u --update Announce new site or updated configuration. Running
- daemons will start subscribing to any new queues needed
- for this site.
- Global events:
- -r --restart Graceful restart of all threads
- --stop Graceful shutdown of all threads
- END_OF_QUEUECTL_HELP;
- require_once INSTALLDIR.'/scripts/commandline.inc';
- function doSendControl($message, $event, $param='')
- {
- print $message;
- $qm = QueueManager::get();
- if ($qm->sendControlSignal($event, $param)) {
- print " sent.\n";
- } else {
- print " FAILED.\n";
- }
- }
- $actions = 0;
- if (have_option('u') || have_option('--update')) {
- $nickname = common_config('site', 'nickname');
- doSendControl("Sending site update signal to queue daemons for $nickname",
- "update", $nickname);
- $actions++;
- }
- if (have_option('r') || have_option('--restart')) {
- doSendControl("Sending graceful restart signal to queue daemons...",
- "restart");
- $actions++;
- }
- if (have_option('--stop')) {
- doSendControl("Sending graceful shutdown signal to queue daemons...",
- "shutdown");
- $actions++;
- }
- if (!$actions) {
- show_help();
- }
|