Created
September 15, 2011 02:29
-
-
Save mauricio/1218369 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
root = File.expand_path( File.join( File.dirname(__FILE__), '..' ) ) | |
Dir.chdir( root ) | |
require 'rubygems' | |
gem 'daemons' | |
require 'daemons' | |
options = { | |
:dir_mode => :normal, | |
:dir => File.join( root, 'tmp', 'pids' ), | |
:log_dir => File.join( root, 'log' ), | |
:log_output => true, | |
:backtrace => true, | |
:multiple => false | |
} | |
ARGV << '--' | |
ARGV << root | |
puts "ARGV before #{ARGV.inspect}" | |
Daemons.run_proc("resque", options) do | |
puts "ARGV after #{ARGV.inspect}" | |
puts "Configured rails env - #{ENV['RAILS_ENV']}" | |
root = ARGV[2] | |
Dir.chdir( root ) | |
require( File.join( root, 'config', 'environment') ) | |
puts "Starting Resque at #{root} - Rails.env = #{Rails.env}" | |
require 'resque' | |
worker = Resque::Worker.new('*') | |
worker.verbose = '1' | |
worker.work(5) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment