Add option to daemonize

This commit is contained in:
Dzmitry Plashchynski
2015-03-03 19:13:17 +02:00
parent 0ead66f626
commit 2ce9db45db
2 changed files with 7 additions and 0 deletions

View File

@@ -49,6 +49,11 @@ module Crono
opts.on("-L", "--logfile PATH", "Path to writable logfile (Default: #{Crono.config.logfile})") do |logfile|
Crono.config.logfile = logfile
end
opts.on("-d", "--[no-]daemonize", "Daemonize process (Default: #{Crono.config.daemonize})") do |daemonize|
Crono.config.daemonize = daemonize
end
end.parse!(argv)
end
end

View File

@@ -7,11 +7,13 @@ module Crono
attr_accessor :schedule
attr_accessor :cronotab
attr_accessor :logfile
attr_accessor :daemonize
def initialize
self.schedule = Schedule.new
self.cronotab = CRONOTAB
self.logfile = LOGFILE
self.daemonize = false
end
end