Skip to content

Instantly share code, notes, and snippets.

@fguillen
Created August 9, 2011 09:05
Show Gist options
  • Save fguillen/1133641 to your computer and use it in GitHub Desktop.
Save fguillen/1133641 to your computer and use it in GitHub Desktop.
Cron & RVM & Bundle & Rails & Rake & log
00 01 * * * /bin/bash --login -c 'cd <your app> && RAILS_ENV=production /usr/bin/env bundle exec rake <your rake>' >> /var/log/<your app>.log 2>&1
@wiktorschmidt
Copy link

So in whenever:
job_type :rake_with_rvm, "/bin/bash --login -c 'cd :path && RAILS_ENV=:environment /usr/bin/env bundle exec rake :task :output'"

@nilbus
Copy link

nilbus commented Aug 2, 2012

Thanks -- I found this via Google and it solved my problem. For whatever reason, bundle exec wouldn't work for me unless I wrap the command in bash -c "bundle exec ..." Much appreciated!

@subimage
Copy link

Bundle and cron were giving me issues before this. Loading the environment through bash -c worked. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment