-1

I am trying to set a cron job on my project to send a email after 15 minutes.

This is in django.config

04_cronjb:
    command: "cat .ebextensions/cron-linux.config > /etc/cron.d/crontab && chmod 644 /etc/cron.d/crontab"
    leader_only: true

This is my cron-linux.config file

files:
    "/etc/cron.d/mycron":
        mode: "000644"
        owner: root
        group: root
        content: |
            

            * * * * * source /opt/python/current/env && python /opt/python/current/app/manage.py cronjb

It all deploys successfully but i am not receiving any email. Cronjb script is working i have tested it. So the error is one these two files. Is there some mistake in it?

shivkhaira
  • 56
  • 1
  • 8

1 Answers1

0

Your 04_cronjb copies entire content of cron-linux.config into crontab. This is sadly incorrect.

Instead you should do as shown here. This includes putting all the bash commands you want to execute in a custom script called, e.g., myscript.sh and then adding myscript.sh to cron only.

Marcin
  • 215,873
  • 14
  • 235
  • 294