Cron Jobs
Run periodic tasks on a schedule you define.
You can create cron jobs on Render that run periodically on a schedule you define. You create cron jobs from the Render Dashboard, just like you create any other type of service:
Your cron job can use any of your GitHub/GitLab/Bitbucket repos, or it can pull a prebuilt Docker image from an external registry.
- If you connect a Git repo, Render builds a new version of your code whenever you push changes to your connected branch. That built version is used for all later runs, until you push additional changes.
- If you pull a Docker image, Render pulls that image before each run of your cron job. Render does not retain pulled images between runs.
Setup
Most of the cron job setup flow is similar to that of any other Render service. However, these fields are specific to cron jobs:
Field | Description |
---|---|
Schedule |
The schedule to use for the cron job, defined as a cron expression. Here are some examples:
Note that all day and time ranges use UTC. |
Command |
The command to execute with each run. This can be:
Make sure your command exits when the cron job finishes! Cron jobs are billed according to how long they run. |
Environment variables
Like any other Render service, cron jobs can set environment variables for values like database URLs and API keys. You can also use environment groups if you need your cron job to share environment variables with other services.
Manually triggering a run
To run your cron job at an unscheduled time (such as for debugging purposes), go to its page in the Render Dashboard and click Trigger Run.
If you manually trigger a cron job run while another run is active, Render first cancels the active run. For details, see Single-run guarantee.
Single-run guarantee
Render guarantees that at most one run of a given cron job is active at a given time. This protects against issues that can arise with parallel execution.
What if I manually trigger a run while another run is active?
Render immediately cancels the active run, then starts the manually triggered run.
What if a run is currently active at the time of the next scheduled run?
Render delays the next scheduled run until the active run finishes.
What if my run never finishes or takes a very long time?
Render stops an active run after 12 hours. To perform tasks that run longer than this (or continuously), instead create a background worker.
Instance types and billing
Cron jobs can use any standard instance type depending on CPU and memory requirements. They are prorated by the second, based on their active running time during a given month. There is a minimum monthly charge of $1 per cron job service.
Cron jobs can’t provision or access a persistent disk.