Trying to run delayed_job 3.0.4 as a daemon
So I have a delayed_job set in a production application. Works great with a rake: work. But when I try to run the script via capistrano:
run "if [ -d #{current_path} ]; then cd #{current_path} && RAILS_ENV=#{rails_env} script/delayed_job start -n 2; fi"
It starts without error. But if I check script/delayed_job status
, it tells me that no instances are running. Any suggestions?
Edit
it looks like something is working (via sudo ps aux | grep delayed
):
1000 7952 0.0 0.1 112312 832 pts/0 S+ 16:17 0:00 grep delayed
Output when I run the script:
/path/to/latest/release/config/initializers/bypass_ssl_verification_for_open_uri.rb:2: warning: already initialized constant VERIFY_PEER
Check the permissions for the shared / tmp / pid folder.
The delayed job will not run if the user who is working in capistrano has permission to write the PID of the file to the folder.
This is how I start the slow running daemon using capistrano, maybe this will work for you as well:
require "delayed/recipes"
%w[start stop restart].each do |command|
after "deploy:#{command}", "delayed_job:#{command}"
end
The output ps aux | grep delayed
only shows its own process, so the DJ doesn't work on your computer. It might have something to do with your if
-clause. You can try uninstalling that and see if it launches correctly using commands ps aux | grep
. The result should be something like this:
username 9989 0.0 0.0 7640 892 pts/0 S+ 10:54 0:00 grep delayed
username 10048 0.0 9.4 288244 99156 ? Sl Jan22 2:16 delayed_job