Class: Moro::Daemon

Inherits:
Object
  • Object
show all
Defined in:
lib/moro/daemon.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Daemon

Returns a new instance of Daemon.



6
7
8
9
10
# File 'lib/moro/daemon.rb', line 6

def initialize(options)
  @monitor=Monitor.new(options)
  log_file="app.log"
  @logger = Logger.new log_file
end

Instance Method Details

#startObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/moro/daemon.rb', line 12

def start()
  start_message="start moro daemon"
  stop_message="stop moro daemon"
  puts start_message
  @logger.info(start_message)

  at_exit do
    puts stop_message
    @logger.info(stop_message)
  end

  while true
    @monitor.show
    @logger.info "stats memory"

    sleep(10)
  end
end