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?
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, eg, myscript.sh
and then adding myscript.sh
to cron only.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.