Class | Beetle::Commands::ConfigurationClient |
In: |
lib/beetle/commands/configuration_client.rb
|
Parent: | Object |
Command to start a RedisConfigurationClient daemon.
Usage: beetle configuration_client [options] -- [client options] client options: --redis-master-file FILE Write redis master server string to FILE --id, --client-id ID Set unique client id (default is minastirith.local) --amqp-servers LIST AMQP server list (e.g. 192.168.0.1:5672,192.168.0.2:5672) --config-file PATH Path to an external yaml config file --pid-dir DIR Write pid and log to DIR -v, --verbose Set log level to DEBUG -h, --help Show this message
parses command line options and starts Beetle::RedisConfigurationClient as a daemon
# File lib/beetle/commands/configuration_client.rb, line 22 22: def self.execute 23: command, controller_options, app_options = Daemons::Controller.split_argv(ARGV) 24: 25: opts = OptionParser.new 26: opts.banner = "Usage: beetle configuration_client #{command} [options] -- [client options]" 27: opts.separator "" 28: opts.separator "client options:" 29: 30: opts.on("--redis-master-file FILE", String, "Write redis master server string to FILE") do |val| 31: Beetle.config.redis_server = val 32: end 33: 34: client_id = nil 35: opts.on("--id ID", "--client-id ID", String, "Set unique client id (default is #{RedisConfigurationClient.new.id})") do |val| 36: client_id = val 37: end 38: 39: opts.on("--amqp-servers LIST", String, "AMQP server list (e.g. 192.168.0.1:5672,192.168.0.2:5672)") do |val| 40: Beetle.config.servers = val 41: end 42: 43: opts.on("--config-file PATH", String, "Path to an external yaml config file") do |val| 44: Beetle.config.config_file = val 45: end 46: 47: dir_mode = nil 48: dir = nil 49: opts.on("--pid-dir DIR", String, "Write pid and log to DIR") do |val| 50: dir_mode = :normal 51: dir = val 52: end 53: 54: opts.on("-v", "--verbose", "Set log level to DEBUG") do |val| 55: Beetle.config.logger.level = Logger::DEBUG 56: end 57: 58: opts.on_tail("-h", "--help", "Show this message") do 59: puts opts 60: exit 61: end 62: 63: opts.parse!(app_options) 64: 65: Daemons.run_proc("redis_configuration_client", :multiple => true, :log_output => true, :dir_mode => dir_mode, :dir => dir) do 66: client = Beetle::RedisConfigurationClient.new 67: client.id = client_id if client_id 68: client.start 69: end 70: end