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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 4, 5:38 am, boblu <bobl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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> 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-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
My first suspicion would be that you need the full path to rake.... but no promises :) On Sep 4, 5:36 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sep 4, 5:38 am, boblu <bobl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 > > > 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-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.