Updated CLI and Config to default to not writing a pidfile unless daemonized.

This commit is contained in:
Thomas Drake-Brockman
2015-04-02 03:14:08 +08:00
parent 48db3ef245
commit 4b28f3dd80
3 changed files with 33 additions and 2 deletions

View File

@@ -50,6 +50,7 @@ module Crono
end
def write_pid
return unless config.pidfile
pidfile = File.expand_path(config.pidfile)
File.write(pidfile, ::Process.pid)
end

View File

@@ -10,9 +10,12 @@ module Crono
def initialize
self.cronotab = CRONOTAB
self.logfile = LOGFILE
self.pidfile = PIDFILE
self.daemonize = false
self.environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
end
def pidfile
@pidfile || (daemonize ? PIDFILE : nil)
end
end
end