174: def daemonize(options={})
175: ops = resolve_defaults(options)
176:
177: if RUBY_PLATFORM !~ /mswin/
178: require 'daemons/daemonize'
179:
180: logfile = ops[:log_file]
181: if logfile[0].chr != "/"
182: logfile = File.join(ops[:cwd],logfile)
183: if not File.exist?(File.dirname(logfile))
184: log "!!! Log file directory not found at full path #{File.dirname(logfile)}. Update your configuration to use a full path."
185: exit 1
186: end
187: end
188:
189: Daemonize.daemonize(logfile)
190:
191:
192: Dir.chdir(ops[:cwd])
193:
194: else
195: log "WARNING: Win32 does not support daemon mode."
196: end
197: end