Can't start the delayed_jobs process
I am having problems getting delayed_job to restart.
When I login and run rake delayed_job RAILS_ENV=production
everything works fine and all the jobs are processed, however if run RAILS_ENV=production script/delayed_job restart
a new process is started, but none of the jobs are processed.
Update: I should also mention that I can run both of the above commands on my dev machine and in both cases all the delayed jobs are processed properly.
Update: I removed the previous update since it was in regards to running the script from my machine, but since I can't get delayed_jobs to process the tasks when calling the command on the server, there is no use in making things even more complex.
Update: Earlier I mentioned that running RAILS_ENV=production script/delayed_job restart
started a process, but didn't do any processing. It turns out that, even though a pid is displayed after running the command, no process matches the pid or is there any additional ruby processes running. Below is the content of the script/delayed_job file:
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
require 'delaye开发者_JS百科d/command'
Delayed::Command.new(ARGV).daemonize
I am using delayed_jobs v2.0.4
According to one of the responses to Terminal says delayed_job starting, but not doing anything there is an issue with the daemon gem v1.1.0. After installing v.1.0.10 it works fine. The reason it was working on my dev machine is I had that 1.0.10 version already installed.
Thanks for the help.
I had the same problem, you need to pass the environment as parameter to the script. There's some quirk in the script handling environment variables correctly:
ruby script/delayed_job -e production restart
I had similar problems getting any delayed_job daemon to start. I traced it back to a permissions problem. If you are using a deploying user, be sure to the script/delayed_job and the log directory writable for that user. Or, modify your /etc/group to give that user permission to the assigned group on those files.
My environment:
ruby (ree-1.8.7-2012.02)
rails (3.2.6)
delayed_job (3.0.3)
delayed_job_active_record (0.3.2)
daemons (1.1.8)
If this is on your production machine, make sure that you have permissions to access the tmp/pids folder. Without it, you wont be able to create any daemons.
精彩评论