Created
March 22, 2016 12:57
-
-
Save meinac/18ba861bf8e1cc3d3625 to your computer and use it in GitHub Desktop.
AWS create cronjob for rake tasks
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
container_commands: | |
01_remove_old_cron_jobs: | |
command: "crontab -u ec2-user -r || exit 0" | |
test: '[ -n "$tier" ] && [ "$tier" = "worker" ]' | |
02_create_cron_command: | |
command: "echo '0 * * * * source /home/ec2-user/.bashrc && pushd /var/app/current && rake task_name' > /home/ec2-user/cron_command" | |
test: '[ -n "$tier" ] && [ "$tier" = "worker" ]' | |
10_run_cron_job: | |
command: "crontab -u ec2-user /home/ec2-user/cron_command" | |
test: '[ -n "$tier" ] && [ "$tier" = "worker" ]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment