Using RVM in a Crontab
If you use rvm
and need to run a crontab
in your server, then you know that it doesn’t work out of the box. The first thing that you might try to do would be something like this:
1 0 * * * bundle exec ruby /your/awesome/script.rb
However you will see all kind of error messages like Gemfile
not found and similar errors.
The correct way to run it, is to invoke directly your ruby installation from your rvm
gemset:
1 0 * * * /usr/local/rvm/bin/ruby-1.9.2-p290@awesomeProject /your/awesome/script.rb
I hope this is helpful.