Comment on page
How to create cron jobs
Cron jobs let you run scripts and other jobs periodically, either based on an interval (for example, every ten minutes) or on a schedule (for example, every Tuesday at 03:00 AM).
To create cron jobs in Release, edit your "Environment Configuration" under Settings.
Edit environment configuration
At the end of the YAML, add a section called
cron_jobsand define any jobs you want to run following the example below.
- name: hello-cron
schedule: "0/5 * * * *"
- "echo 'hi from cron'"
Press Save as new version.
Save new configuration version
Back in your Environment Settings page, apply this new configuration to your environment. This will redeploy your existing instances, and also add a new one to run the cron job you defined.
Apply latest configuration
Wait for the new environment to deploy. If you used the configuration from the example above, you should see a new instance come up every five minutes. Viewing the logs of that instance will confirm that the job ran as expected.
Viewing the CronJob log
Cron jobs are distinct from jobs in that:
- Cron jobs are run on a schedule or timer.
- Jobs are run manually or based on events, for example, after a backend service comes up.