title: Can you run a cronjob with Amazon SQS?
body: <p>I have my app with Elastic Beanstalk and  I need to create a cronjob that run a task in rails</p>
  
  <pre><code>rake "sitemap:generate"
  </code></pre>
  
  <p>and I wonder if I can do it with Amazon SQS, anyone knows how to do that?</p>
  
  <p>I tried to do a crontab but it doesn't work in the beanstalk...</p>
  
  <pre><code>files:
    "/tmp/cron_job.sh":
      mode: "000777"
      content: |
        #!/usr/bin/env bash
        */2 * * * *  cd /var/app/current/ &amp;&amp; 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
  </code></pre>
  
  <p>Is there another way to do a cronjob in Elastic Beanstalk?</p>
  
  <p>Thank you.</p>