Sha256: eaa7ee584deac89b5d14bf0d47cc7b73b8b2b731ced3b3f7826c3ed58979b830
Contents?: true
Size: 1.59 KB
Versions: 1
Compression:
Stored size: 1.59 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'ostruct' # add lib to the default include path unless $:.include?(File.dirname(__FILE__) + '/../lib/') $: << File.dirname(__FILE__) + '/../lib' end require 'flapjack/configuration' options = OpenStruct.new options.config = File.join('etc', 'flapjack_config.yaml') options.daemonize = nil OptionParser.new do |opts| opts.banner = "Usage: flapjack [options]" opts.on("-c", "--config [PATH]", String, "PATH to the config file to use") do |c| options.config = c end opts.on("-d", "--[no-]daemonize", "Daemonize?") do |d| options.daemonize = d end opts.on("-p", "--pidfile [PATH]", String, "PATH to the pidfile to write to") do |p| options.pidfile = p end end.parse!(ARGV) FLAPJACK_ENV = ENV['FLAPJACK_ENV'] || 'development' config_env = Flapjack::Configuration.new.load(options.config) if config_env.nil? || config_env.empty? puts "No config data for environment '#{FLAPJACK_ENV}' found in '#{options.config}'" exit(false) end if options.pidfile.nil? pid_file = (config_env['pid_file'] || 'tmp/pids/flapjack.pid') else pid_file = options.pidfile end # TODO Flapjack falls over when Redis restarted -- trap errors and attempt reconnect require 'flapjack/coordinator' coordinator = Flapjack::Coordinator.new(config_env) coordinator.log_file = (config_env['log_file'] || 'log/flapjack.log') coordinator.pid_file = pid_file if options.daemonize.nil? daemonize = !!config_env['daemonize'] else daemonize = options.daemonize end puts "Daemonising ... " if daemonize coordinator.start(:daemonize => daemonize, :signals => true)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flapjack-0.6.39 | bin/flapjack |