bin/rapnd in rapnd-0.1.4 vs bin/rapnd in rapnd-0.1.5
- old
+ new
@@ -3,12 +3,11 @@
ARGV << '--help' if ARGV.empty?
require 'optparse'
require 'rapnd'
-require 'rubygems' unless defined?(Gem)
-require 'forever'
+require 'daemons'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: rapnd [options]"
@@ -52,16 +51,16 @@
puts opts
end
end.parse!
unless options[:foreground]
- Forever.run do
- dir options[:dir]
- log "#{options[:queue]}.log"
-
- on_ready do
- Rapnd::Daemon.new(options).run!
- end
- end
-else
- Rapnd::Daemon.new(options).run!
-end
+ Daemons.daemonize(
+ :app_name => options[:queue],
+ :dir_mode => :normal,
+ :dir => "#{options[:dir]}/tmp",
+ :log_dir => "#{options[:dir]}/log",
+ :backtrace => true,
+ :log_output => true
+ )
+end
+
+Rapnd::Daemon.new(options).run!
\ No newline at end of file