Rails cron whenever, bundle: command not found

In my case I just ran :

rvm env --path -- ruby-version[@gemset-name]

Referring to cron job setup doc

Added new source line to the command for ruby path before bundle command in the crontab -e

source /usr/local/rvm/environments/ruby-1.9.3-p392;

Now the commands like as below:

Before:

0 4 * * * cd /home/current && bundle exec rake my_rake RAILS_ENV=production

After:

0 4 * * * cd /home/current && source /usr/local/rvm/environments/ruby-1.9.3-p392; bundle exec rake my_rake RAILS_ENV=production

Cheers!!!


You can also ensure your PATH ends up in the crontab, by putting the following at the top of the schedule.rb file:

env :PATH, ENV['PATH']

https://groups.google.com/forum/#!msg/whenever-gem/yRLt3f2jrfU/Exu3xfCo8DAJ

If above solution don't work for you, try:

env :GEM_PATH, ENV['GEM_PATH']