Last active
October 23, 2015 15:40
-
-
Save CarlosEspejo/6a28035365382ae6401f to your computer and use it in GitHub Desktop.
Rake Tasks via CRON
This file contains 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
# Look into | |
# Explicitly define PATH at the top of your crontab file: | |
PATH=/Users/deployer/.rbenv/shims:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin | |
Or | |
export PATH=~/.rbenv/shims:~/.rbenv/bin:"$PATH" | |
# Run crontab -e to open the schedule for the current account | |
crontab -e | |
# To see whats loaded in ENV | |
*/1 * * * * env > /tmp/env.txt | |
# To get a non-interactive login shell and wire up Rbenv correctly | |
bash -lc "[commands]" | |
# Make sure to cd into the project first | |
58 12 * * * bash -lc "cd /home/appuser/apps/example/current && bundle exec rake data:morning RAILS_ENV=production >> /tmp/cron.log 2>&1" | |
28 19 * * * bash -lc "cd /home/appuser/apps/example/current && bundle exec rake data:afternoon RAILS_ENV=production >> /tmp/cron.log 2>&1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment