Skip to content

Instantly share code, notes, and snippets.

@kixorz
Last active June 18, 2017 11:14
Show Gist options
  • Select an option

  • Save kixorz/5283355 to your computer and use it in GitHub Desktop.

Select an option

Save kixorz/5283355 to your computer and use it in GitHub Desktop.
Running Rake tasks from Cron with RVM. Place the crontab.sh file in the root of your Rails project and make it executable. Edit crontab accordingly.
#run a command every day at midnight under user ubuntu
0 0 * * * ubuntu /<path to your rails project>/crontab.sh bundle exec rake <parameters> > /dev/null 2> /dev/null
#!/bin/bash
source "/usr/local/rvm/scripts/rvm"
cd "$(dirname "$0")"
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment