collectiveidea/delayed_job — Issue #353: Problem when starting in production through capistrano and/or god
Author: rmanusama
Created: 2012-02-11 04:07:32+00:00
State: open

Hi,

I run delayed_job through god config as showed on https://github.com/blog/229-dj-god and it works fine on staging server.

However, strangely, on production server it started the process but does not process any job on the queue

I also tried to run it manually using capistrano recipe (also already created script/delayed_job to run it as a daemon). Again this works on staging server but not on production.

So I tried manually typing capistrano script, doesnt work either:

```ruby
namespace :delayed_job do
def rails_env
fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : ''
end

def args
fetch(:delayed_job_args, "")
end

def roles
fetch(:delayed_job_server_role, :app)
end

desc "Stop the delayed_job process"
task :stop, :roles => lambda { roles } do
run "cd #{current_path};#{rails_env} script/delayed_job stop"
end

desc "Start the delayed_job process"
task :start, :roles => lambda { roles } do
run "cd #{current_path};#{rails_env} script/delayed_job start #{args}"
end

desc "Restart the delayed_job process"
task :restart, :roles => lambda { roles } do
run "cd #{current_path};#{rails_env} script/delayed_job restart #{args}"
end
end
```

Strangely enough, everything works fine if i run the following manually:
```ruby
RAILS_ENV=production script/delayed_job start
#or
RAILS_ENV=production rake jobs:work
```

Of course, I would need to run this using god. it is quite strange that this problem occur

Thanks!!
Rama