Last active
June 18, 2017 11:14
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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