Sha256: d1f24407430aadf2c895899ee1906f9c8380e99bb5649a41cb0d9d56f80dec4c

Contents?: true

Size: 836 Bytes

Versions: 3

Compression:

Stored size: 836 Bytes

Contents

# require 'multi_daemons/version'
require_relative 'multi_daemons/controller'
require_relative 'multi_daemons/pid_store'
require_relative 'multi_daemons/pid'
require_relative 'multi_daemons/daemon'
require_relative 'multi_daemons/validate'
require 'fileutils'
require 'byebug'
require 'timeout'

module MultiDaemons
  def self.runner(daemons, options = {})
    raise unless Validate.valid_multi_daemon?(daemons)

    controller = Controller.new(daemons, options)
    daemonize(controller)
  end

  def self.daemonize(controller)
    case !ARGV.empty? && ARGV[0]
    when 'start'
      controller.start
    when 'stop'
      controller.stop
    when 'restart'
      controller.stop
      controller.start
    when 'status'
      controller.status
    else
      raise 'Invalid argument. Specify start, stop or restart'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
multi_daemons-0.1.3 lib/multi_daemons.rb
multi_daemons-0.1.2 lib/multi_daemons.rb
multi_daemons-0.1.1 lib/multi_daemons.rb