lib/resque/tasks.rb in mongo-resque-1.19.0.1 vs lib/resque/tasks.rb in mongo-resque-1.20.0

- old
+ new

@@ -16,9 +16,16 @@ worker.very_verbose = ENV['VVERBOSE'] rescue Resque::NoQueueError abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work" end + if ENV['BACKGROUND'] + unless Process.respond_to?('daemon') + abort "env var BACKGROUND is set, which requires ruby >= 1.9" + end + Process.daemon(true) + end + if ENV['PIDFILE'] File.open(ENV['PIDFILE'], 'w') { |f| f << worker.pid } end worker.log "Starting worker #{worker}"