Skip to content

Instantly share code, notes, and snippets.

@oliyoung
Created February 1, 2019 01:14
Show Gist options
  • Save oliyoung/3a8688d5099d521f20aac5a964ef6cf3 to your computer and use it in GitHub Desktop.
Save oliyoung/3a8688d5099d521f20aac5a964ef6cf3 to your computer and use it in GitHub Desktop.
Cron config for Elastic Beanstalk
files:
"/var/spool/cron/ec2-user":
mode: "000600"
owner: ec2-user
group: ec2-user
content: |
*/15 * * * * /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bundle exec rake schedule:quarter_hour > /var/app/current/log/cron-quarter-hour.log'
1 * * * * /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bundle exec rake schedule:hourly > /var/app/current/log/cron-hourly.log'
3 */3 * * * /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bundle exec rake schedule:three_hours > /var/app/current/log/cron-three.log'
5 20 * * * /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bundle exec rake schedule:open_of_business > /var/app/current/log/cron-open.log'
7 6 * * * /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bundle exec rake schedule:close_of_business > /var/app/current/log/cron-close.log'
9 16 * * * /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bundle exec rake schedule:daily > /var/app/current/log/cron-daily.log'
* * * * 0 /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bundle exec rake schedule:weekly > /var/app/current/log/cron-weekly.log'
* * 1 * * /bin/bash -l -c 'cd /var/app/current && RAILS_ENV=production bundle exec rake schedule:monthly > /var/app/current/log/cron-monthly.log'
"/opt/elasticbeanstalk/hooks/appdeploy/post/008_touch_cron_log.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
touch /var/app/current/log/cron-{quarter_hour,hourly,three,open,close,daily,weekly,monthly}.log
sudo chown ec2-user:ec2-user /var/app/current/log/cron*.log
sudo chmod 766 /var/app/current/log/cron*.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment