Class: Furikake::Monitor
Instance Method Summary collapse
-
#initialize(options) ⇒ Monitor
constructor
A new instance of Monitor.
- #run ⇒ Object
Methods inherited from Report
Methods included from Config
Constructor Details
#initialize(options) ⇒ Monitor
Returns a new instance of Monitor.
5 6 7 8 9 10 11 12 13 |
# File 'lib/furikake/monitor.rb', line 5 def initialize() super(true) $stdout.sync = true @logger = Logger.new($stdout) @flag_int = false @detach = [:detach] @pid_file = [:pid] @interval = [:interval] end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/furikake/monitor.rb', line 15 def run begin @logger.info 'furikake monitor を起動します.' daemonize set_trap monitor @logger.warn "furikake monitor を停止しました." File.delete(@pid_file) if File.file?(@pid_file) rescue => e @logger.error "monitor の起動に失敗しました. #{e}" exit 1 end end |