rake background task can not run

I want to use rake background task in rails like this

system("cd #{Rails.root} && RAILS_ENV=#{Rails.env} rake abc:def -- trace 2>&1 >> #{Rails.root}/log/rake.log &")

This is ok in development environment, but will not work in production mode.

I used logger to check whether the command string is generated ok or not, but it seems every things is fine in production evironment:

cd /home/username/rails_staging/Abc/releases/20100904034630 && RAILS_ENV=production rake abc:def --trace 2>&1 >> /home/username/ rails_staging/Abc/releases/20100904034630/log/rake.log &

Any body has any ideas about why this can not work in production mode?

Thanks

I want to use rake background task in rails like this

system("cd #{Rails.root} && RAILS_ENV=#{Rails.env} rake abc:def -- trace 2>&1 >> #{Rails.root}/log/rake.log &")

This is ok in development environment, but will not work in production mode.

What happens?

Fred

My first suspicion would be that you need the full path to rake.... but no promises :slight_smile: