Cronjob is not ran in Elastic Beanstalk

I am running Django in Elastic Beanstalk, platform: Python 3.7 running on 64bit Amazon Linux 2/3.4.0.

I need to create a cronjob that runs a custom Django management command once every five minutes.

I created the following file to .ebextensions/cron.config:

        mode: "000644"
        owner: root
        group: root
        content: |
            5 * * * * root /usr/local/bin/
        mode: "000755"
        owner: root
        group: root
        content: |
            source /var/app/venv/*/bin/activate && python3 mycommand
            exit 0
        command: "rm -f /etc/cron.d/mycron.bak"

And redeployed the enviroment with eb deploy. However, the cron job does not get run.

My questions are:

  • What have I done wrong?
  • How can I see if the cron.config file gets processed?
  • How can I check that some cronjob gets ran?
Back to Top