bin/bluepill in ra-bluepill-0.0.44 vs bin/bluepill in ra-bluepill-0.0.45

- old
+ new

@@ -4,11 +4,12 @@ # Default options options = { :log_file => "/var/log/bluepill.log", :base_dir => "/var/bluepill", - :privileged => true + :privileged => true, + :timeout => 10 } OptionParser.new do |opts| opts.banner = "Usage: bluepill [app] cmd [options]" opts.on('-l', "--logfile LOGFILE", "Path to logfile, defaults to #{options[:log_file]}") do |file| @@ -26,10 +27,14 @@ opts.on("--[no-]privileged", "Allow/disallow to run #{$0} as non-privileged process. disallowed by default") do |v| options[:privileged] = v end + opts.on('-t', '--timeout Seconds', Integer, "Timeout for commands sent to the daemon, in seconds. Defaults to 10.") do |timeout| + options[:timeout] = timeout + end + help = proc do puts opts puts puts "Commands:" puts " load CONFIG_FILE\t\tLoads new instance of bluepill using the specified config file" @@ -55,11 +60,11 @@ exit(3) end APPLICATION_COMMANDS = %w(status start stop restart unmonitor quit log) -controller = Bluepill::Controller.new(options.slice(:base_dir, :log_file)) +controller = Bluepill::Controller.new(options.slice(:base_dir, :log_file, :timeout)) if controller.running_applications.include?(File.basename($0)) && File.symlink?($0) # bluepill was called as a symlink with the name of the target application options[:application] = File.basename($0) elsif controller.running_applications.include?(ARGV.first) @@ -95,10 +100,10 @@ ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) load_path = File.expand_path("#{File.dirname(__FILE__)}/../lib") file_path = File.expand_path(file) exec(ruby, "-I#{load_path}", '-rbluepill', file_path) - + else $stderr.puts "Can't find file: #{file}" end else target = ARGV.shift