Class: Pazuzu::SupervisorRunner
- Inherits:
-
Object
- Object
- Pazuzu::SupervisorRunner
- Defined in:
- lib/pazuzu/supervisor_runner.rb
Overview
Runs the supervisor daemon from the command line.
Instance Method Summary collapse
-
#initialize ⇒ SupervisorRunner
constructor
A new instance of SupervisorRunner.
- #run!(arguments = []) ⇒ Object
Constructor Details
#initialize ⇒ SupervisorRunner
Returns a new instance of SupervisorRunner.
6 7 8 |
# File 'lib/pazuzu/supervisor_runner.rb', line 6 def initialize @run_as_daemon = false end |
Instance Method Details
#run!(arguments = []) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pazuzu/supervisor_runner.rb', line 10 def run!(arguments = []) OptionParser.new do |opts| opts. = "Usage: #{prog_name} [OPTIONS]" opts.separator "" opts.on("-d", "--daemon", 'Run as daemon') do @run_as_daemon = true end opts.on("-p PATH", "--pid", "Store pid in PATH (defaults to #{DEFAULT_PID_PATH})") do |value| @pid_path = File.(value) end opts.on("-c FILE", "--config FILE", "Read configuration from FILE (defaults to #{DEFAULT_CONFIG_PATH})") do |value| @config_path = File.(value) end opts.on("-h", "--help", "Show this help.") do puts opts exit end opts.parse!(arguments) end if @run_as_daemon daemonize! else execute! end rescue => e abort "#{prog_name}: #{e.}" end |