1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
- $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();
- }
|