Whenever a stone fails the task

I created a rails project to use the Whenever gem. Now I am deploying my project with Capistrano and the tasks are nicely added to the crontab list. But when I only see one line:

/bin/bash: bundle: command not found

      

So I read several articles on the internet so I added this on top of my schedule.rb file

env 'PATH', ENV['PATH']

      

So, you should think that the problem is solved because it will add the following line to the crontab:

PATH=/var/rails/alfa_paints/shared/bundle/ruby/1.9.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

      

So, you should think that the bundle is in the path when the command is executed. But so far no luck. I ran the command and deploy with a separate user. So to make sure everything works with this user, the deployer in this case. I figured out the role of the deployer and ran the command in the crontab. I have not experienced any problems with this command.

I'm running out of options and was wondering if anyone else experienced this strange behavior? I hope for some advice. This is the output in my crontab:

# Begin Whenever generated tasks for: alfa_paints
 PATH=/var/rails/alfa_paints/shared/bundle/ruby/1.9.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

0 1 * * * /bin/bash -l -c 'cd /var/rails/alfa_paints/releases/20130127192223 && RAILS_ENV=production bundle exec rake alfa:cleanup --silent >> /var/rails/alfa_paints/shared/log/whenever.log 2>&1'

# End Whenever generated tasks for: alfa_paints

      

Any help is appreciated!

+3


source to share


2 answers


You will need to pass the required environment variables to the crontab.

Add these lines at the top of your crontab (crontab -e)

(obviously you will change the values โ€‹โ€‹of the variables to be presented in your environment)

(in this case I am using RVM)



PATH = / home / deploy / .rvm / gems / ruby-2.0.0-P247 / bin: /home/deploy/.rvm/gems/ ruby-2.0.0p247@global /bin:/Home/expand/.rvm / rubies / ruby โ€‹โ€‹2.0.0p247 / bin: /home/deploy/.rvm/bin: / usr / local / bin: / usr / bin: / bin: / usr / local / games: / usr / games: / usr / bin /: / home / expand / .rvm / bin

GEM_HOME = / home / expand / .rvm / gems / ruby-2.0.0-P247

GEM_PATH = / home / deploy / .rvm / gems / ruby-2.0.0-p247 / home / deploy / .rvm / gems / ruby-2.0.0-p247@global

MY_RUBY_HOME = / home / expand / .rvm / rubies / ruby-2.0.0-P247

+1


source


Which shell are you using? As I saw when adding 'bash -l -c' to the job command. Or install

set: job_template, nil

or if you are using zsh then



set: job_template, "zsh -l -c ': job'"

This solved my problem

+1


source







All Articles