Class: Moro::Daemon
- Inherits:
-
Object
- Object
- Moro::Daemon
- Defined in:
- lib/moro/daemon.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ Daemon
constructor
A new instance of Daemon.
- #start ⇒ Object
Constructor Details
#initialize(config) ⇒ Daemon
Returns a new instance of Daemon.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/moro/daemon.rb', line 7 def initialize(config) @monitor=Monitor.new(config) @logger = Logger.new STDOUT build_handlers(config) puts config if config["interval"]!=nil @interval=config["interval"] else @interval=30 end end |
Instance Method Details
#start ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/moro/daemon.rb', line 20 def start() ="start moro daemon" ="stop moro daemon" puts @logger.info() at_exit do puts @logger.info() end while true process_usages=@monitor.monit @handlers.each do |handler| handler.send(process_usages) end @logger.info "stats memory" sleep(@interval) end end |