I set up a rails project to use the Whenever gem. Now I deploy my project with Capistrano and the tasks are nicely added to crontab list. But when I see only one line:
/bin/bash: bundle: command not found
So I read a couple of articles online so I added this on top of my schedule.rb file
env 'PATH', ENV['PATH']
So you should think problem solved, because this will add this next 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 bundle is in the path when the command gets executed. But still no luck. I ran the command and the deployment with a seperate user. So to make sure everything runs with that user, deployer in this case. I asssumed the role of deployer and ran the command as specified in crontab. I didn't experience any problems when executing this command.
I'm running out of options and was wondering if anybody else experienced this strange behavior? I'm hoping for some advise. 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 welkom!