Sha256: 8adbf2ade8ef9cd8efdae619ebb587de392bdd83d2b2468f6642eea49ed7a235
Contents?: true
Size: 1018 Bytes
Versions: 2
Compression:
Stored size: 1018 Bytes
Contents
require "thread" require "optparse" require "logger" require "fileutils" require "timeout" require "daemonic/version" require "daemonic/daemon" require "daemonic/cli" require "daemonic/producer" require "daemonic/pool" Thread.abort_on_exception = true module Daemonic def self.run(worker, default_options = {}) command, options = CLI.new(ARGV, default_options).run case command when :start then start(worker, options) when :stop then stop(options) when :status then status(options) when :restart then restart(worker, options) end end def self.start(worker, options) daemon = Daemon.new(options) daemon.start do Producer.new(worker, options).run end end def self.stop(options) Daemon.new(options).stop end def self.status(options) Daemon.new(options).status end def self.restart(worker, options) daemon = Daemon.new(options.merge(daemonize: true)) daemon.restart do Producer.new(worker, options).run end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
daemonic-0.1.1 | lib/daemonic.rb |
daemonic-0.1.0 | lib/daemonic.rb |