Skip to content

Cron ​

How it works ​

A cron job is a URL, a method and a schedule. on.dev calls the URL when the schedule is due and records the result. A run fails on a status outside 200 to 299, a timeout or a connection error. After any retries, the first failure sends an alert, and the next success sends a recovery alert.

Schedules ​

Schedules use the standard five fields, in UTC:

text
┌ minute (0-59)
│ ┌ hour (0-23)
│ │ ┌ day of month (1-31)
│ │ │ ┌ month (1-12 or jan-dec)
│ │ │ │ ┌ day of week (0-7 or sun-sat, 0 and 7 are Sunday)
* * * * *
ScheduleRuns
*/15 * * * *Every 15 minutes
0 * * * *Every hour, on the hour
0 3 * * *Every day at 03:00 UTC
30 9 * * mon-friWeekdays at 09:30 UTC
0 0 1 * *The first of every month at midnight UTC

Fields take lists (1,15), ranges (1-5) and steps (*/10, 0-30/10). The shortcuts @hourly, @daily, @weekly, @monthly and @yearly work too. When both day fields are set, a day matching either one runs, as in standard cron.

The dashboard shows the next three runs as you type.

The shortest interval between runs is 5 minutes on Free and 1 minute on Pro. If on.dev was unavailable when a run was due, the job runs once when it's back, not once per missed run.

Requests ​

  • Methods: GET, POST, PUT, PATCH, DELETE and HEAD.
  • Up to 10 headers, written as Name: value. Use a header such as Authorization for secrets, not the URL.
  • A body of up to 8 KB for methods other than GET and HEAD. Set Content-Type to match.
  • A timeout of 5 to 30 seconds. A slower request is cut off and counts as failed.
  • Redirects are followed.
  • Requests come from Cloudflare's network with the user agent on.dev-cron/1 (+https://on.dev/cron).

Jobs can only call public addresses: not localhost, private networks or on.dev itself.

Retries ​

Set up to 3 retries. A failed run is tried again after 30 seconds, then 60, then 90. You're alerted only if the last try fails too. Each try shows in the run log.

Run now ​

Run now calls the URL straight away, even while the job is paused. It can be used once a minute per job.

Run history ​

Every run records its status code, duration, error and the first 1 KB of a text response. History is kept for 7 days on Free and 30 days on Pro.