Class: Erlnixify::Main
- Inherits:
-
Object
- Object
- Erlnixify::Main
- Defined in:
- lib/erlnixify.rb
Overview
The main entry point for erlnixify
Class Method Summary collapse
Class Method Details
.main(args) ⇒ 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/erlnixify.rb', line 10 def self.main(args) @opts = Erlnixify::Opts.new(args) = nil = @opts.[@opts.command] if [:version] puts Erlnixify::VERSION exit 0 end if ((@opts.command == "start" or @opts.command == "startdaemon") and not [:command]) puts "missing command option, this is required" puts @opts.opts.help exit 1 end if not [:name] puts "missing name option" puts @opts.opts.help exit 1 end if not ([:cookie] || [:cookiefile]) puts "missing both cookie and cookiefile options, at least one is required" puts @opts.opts.help exit 1 end @settings = Erlnixify::Settings.new() @node = Erlnixify::Node.new(@settings) begin case @opts.command when :start @node.start when :startdaemon @node.start_daemon exit 0 when :stop @node.stop when :status begin @node.status rescue Exception => msg puts "stopped", msg exit 127 end else @node.start end rescue Erlnixify::NodeError exit 127 end end |