def daemonize(options={})
ops = resolve_defaults(options)
if RUBY_PLATFORM !~ /mingw|mswin/
require 'daemons/daemonize'
logfile = ops[:log_file]
if logfile[0].chr != "/"
logfile = File.join(ops[:cwd],logfile)
if not File.exist?(File.dirname(logfile))
log "!!! Log file directory not found at full path #{File.dirname(logfile)}. Update your configuration to use a full path."
exit 1
end
end
Daemonize.daemonize(logfile)
Dir.chdir(ops[:cwd])
else
log "WARNING: Win32 does not support daemon mode."
end
end