I have my app with Elastic Beanstalk and I need to create a cronjob that run a task in rails
rake "sitemap:generate"
and I wonder if I can do it with Amazon SQS, anyone knows how to do that?
I tried to do a crontab but it doesn't work in the beanstalk...
files:
"/tmp/cron_job.sh":
mode: "000777"
content: |
#!/usr/bin/env bash
*/2 * * * * cd /var/app/current/ && RACK_ENV=production bundle exec rake sitemap:generate
encoding: plain
container_commands:
01_delete_cron_jobs:
command: "crontab -r -u ec2-user || exit 0"
02_add_cron_jobs:
command: "crontab /tmp/cron_job.sh -u ec2-user"
leader_only: true
Is there another way to do a cronjob in Elastic Beanstalk?
Thank you.
Aucun commentaire:
Enregistrer un commentaire