Cron jobs
How to create cron jobs
Last updated
How to create cron jobs
Last updated
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.
At the end of the YAML, add a section called cron_jobs
and define any jobs you want to run following the example below.
Press Save as new version.
Click Deploy -> Deploy Patch to 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.
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.
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.
Instead of choosing an image
to base your cron job on, you can define from_services
to base your cron job on an existing service. You can find more examples and the full schema in the schema docs.