6.05.2014

Schedule rake using cron on rvm environment

Little tricky to get this going. The key is knowing rvm environment.
$ rvm env --path
/auto/home3/delacs/.rvm/environments/ruby-2.0.0-p353@RailsDev
For rvm, basic command line tools like gem, rake and ruby are in the wrappers directory.
$ crontab -l
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
HOME=/auto/home3/delacs
RAILS_ENV=development

0 7 * * * /bin/bash -l -c 'source ~/.bash_profile' && cd $HOME/Documents/projects/monweb_management && $HOME/.rvm/wrappers/ruby-2.0.0-p353@RailsDev/rake perfdb:get_baselines >> $HOME/logs/db.import.log 2>&1

5 7 * * * /bin/bash -l -c 'source ~/.bash_profile' && cd $HOME/Documents/projects/monweb_management && $HOME/.rvm/wrappers/ruby-2.0.0-p353@RailsDev/rake perfdb:get_published_runs  >> $HOME/logs/db.import.log 2>&1

No comments:

Post a Comment