Cron jobs are not be available on all project subscription plans.
To enable the tasks, open your project on the Control Panel and select Cron Jobs from the menu. Next enter the command and select the period, in which the repeating task should be run.
For example, if you select every 10 minutes, the task will be run every hour at :10, :20, :30, :40, :50 and :00.
A command could be something simple like:
python manage.py sync_my_db
Or, the cron job can execute a script.
Important: after adding or changing a cron job, the server will need to be redeployed for the cron configuration to be applied.
Running tasks manually
Jobs can be run manually, for testing or other purposes. To run a job manually:
- select Copy Command from its options menu
- paste the command into a terminal
The command will open an SSH session to the appropriate environment, and execute the cron job. For example:
ssh -p 22 firstname.lastname@example.org "sh cronjobs/rebuild_index.sh"
Cron job timeouts
We apply a timeout of ten minutes on processes started by Cron jobs. Longer-running processes should be handled by Celery instead.