Cron Jobs


You can create cron jobs (or scheduled jobs) on Render using any of your GitHub or GitLab repositories.

Just like with web services, you can choose the appropriate runtime environment and branch in the repo that contains your cron job code.

When you push changes to your repo, Render automatically builds a new version of your code for the next scheduled run of your cron job. Each execution of your job runs in a new instance of your code.

Cron Schedule

Using a cron expression allows you to specify the schedule for the command or script you’d like to run periodically.

Cron Command

Render cron job instances are Linux environments, so the cron command should be one of the following:

  1. Any valid Linux command like echo 'hello'.
  2. An executable bash script containing the command(s) you’d like to run periodically.

Environment Variables

Just like any other service on Render, cron jobs can use environment variables for things like database URLs and API keys. You can also use Environment Groups if you need your cron jobs to share environment variables with other cron jobs or services.

Running Cron Jobs Manually

Sometimes you need to run a cron job off-schedule, perhaps for debugging. You can always trigger a cron job run manually. As mentioned below, this will cancel a currently running job.

Cron job history with trigger button at the top right

Cron Job Concurrency & Timeouts

Not all cron jobs tolerate multiple, concurrent runs. This is why Render guarantees that at most one run is active at any given time for every cron job. This raises a few questions.

What happens when I manually trigger a run while another run is executing?

To keep our single-run guarantee, when you manually trigger a run during another active run for the same cron job, we cancel the active run and start a new one.

What happens if my job hasn’t finished by the time of the next scheduled run?

To keep our single-run guarantee, the next scheduled run is delayed until the previous run is finished. The delayed job run starts once the previous job is done.

What if my run never finishes or takes a very long time?

A cron job run will be stopped if it does not complete within 12 hours of starting. For jobs that that need to run continuously, use background workers.