I'm having trouble getting my cron jobs to execute.
Setup:
Django - 1.9
Elastic beanstalk - 64bit Amazon Linux 2016.03 v2.1.3 running Python 3.4
I've tried doing this a couple of ways so far:
Using a cron.yaml file: Didn't touch anything else - just added a cron.yaml file to my project root folder
version: 1 cron:
- name: "test" url: "http://website.com/workers/test" schedule: "*/10 * * * *"Using a container command and a separate cron.txt file:
Added this line in my .ebextensions/development.config file
05_some_cron:
command: "cat .ebextensions/crontab.txt > /etc/cron.d/crontab && chmod 644 /etc/cron.d/crontab"
leader_only: true
and in .ebextensions/crontab.txt
*/10 * * * * source /opt/python/run/venv/bin/activate && python mysite/manage.py test
The app deploys successfully in both cases.
- Manually (in a browser) going to http://website.com/workers/test has the intended outcome (in the first case).
- Adding
source /opt/python/run/venv/bin/activate && python mysite/manage.py test
as a management command runs the correct script once on deploying.
The logs do not show any GETS on that url.
What am I doing wrong? Am I missing some step of the process or some setup step on EBS?
Also what is the best ways to run cron jobs for django applications hosted on EBS? - django apps can run management commands either from the command line as in attempt 2 or by extending a GET or POST url as in attempt 1.