Forked from lukeredpath/Delayed::Job daemon script for delayed_job
Created
January 31, 2010 14:52
-
-
Save neilfws/291097 to your computer and use it in GitHub Desktop.
Daemon script with minor alteration to use Navvy instead of delayed_job
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 | |
require 'rubygems' | |
require 'daemons' | |
dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) | |
daemon_options = { | |
:multiple => false, | |
:dir_mode => :normal, | |
:dir => File.join(dir, 'tmp', 'pids'), | |
:backtrace => true | |
} | |
Daemons.run_proc('job_runner', daemon_options) do | |
if ARGV.include?('--') | |
ARGV.slice! 0..ARGV.index('--') | |
else | |
ARGV.clear | |
end | |
Dir.chdir dir | |
RAILS_ENV = ARGV.first || ENV['RAILS_ENV'] || 'development' | |
require File.join('config', 'environment') | |
Navvy::Worker.start | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment