Schedule work with Cron Jobs
Run a function, SQL, an action, an HTTP call or an email on a schedule, and read the run history.
Cron Jobs run something automatically on a schedule: send a report every morning, clean up old rows every night, ping another service every five minutes.
Open Cron Jobs
In your project's sidebar, choose Cron Jobs. The page, Cron & Scheduled Tasks, shows your active schedules, a list of Configured Cron Jobs and Recent Execution History. A supervisor checks for due jobs about every 15 seconds.
Create a job
- Choose New Cron Job.
- Enter a Job Name and optionally a Description.
- Set the Schedule Expression (5-part Cron), or choose a shortcut: Every 5m, Hourly, Daily (8 AM), Daily (Midnight), Weekly (Mon 8 AM) or Monthly (1st).
- Choose a Timezone. The default is UTC, and a list of common zones is offered.
- Under Target Execution Layer, choose what to run (see below).
- Choose a Concurrency Policy and a Timeout Limit (Seconds).
- Choose Save Cron Job.
Reading a cron expression
Five fields separated by spaces: minute (0-59), hour (0-23), day of month (1-31), month (1-12) and day of week (0-6, Sunday is 0).
| Expression | Meaning |
|---|---|
*/5 * * * * |
Every 5 minutes |
0 * * * * |
Every hour, on the hour |
0 8 * * * |
Every day at 8:00 |
0 8 * * 1 |
Every Monday at 8:00 |
0 8 1 * * |
The 1st of every month at 8:00 |
Times follow the timezone you chose. A Syntax Guide & Cheatsheet button on the page opens the same reference.
What a job can run
- Function: pick a deployed function and, optionally, a Custom JSON Input Payload.
- SQL Query: a statement such as a nightly cleanup or a materialized-view refresh.
- Action: one of your registered actions. See Actions.
- HTTP: a request (POST, GET, PUT or DELETE) to a URL, such as a heartbeat to another service. The address must be public. Internal or private addresses are blocked.
- Mail: an email with a recipient and subject. Your project needs mail access.
Concurrency
- Forbid Concurrent (Skip if active): if the previous run is still going when the next is due, the new one is skipped, so runs never pile up.
- Allow Concurrent: runs may overlap.
Run it now, edit and read history
Each job has Run to start it immediately, Edit to change it and Logs to see its output. The row shows Next Execution and Last Run, with OK, FAILED or TIMEOUT. Recent Execution History lists each run with its status, trigger, time, duration and attempt number. Choose Inspect Trace to see details. Use the Active switch to pause a job without deleting it.
From code
const job = await admin.cron.create(/* name, expression, target, ... */);
await admin.cron.run(job.id); // run now
await admin.cron.listRuns(job.id); // history
await admin.cron.toggle(job.id, false); // pause
These calls need a secret key.
Good to know
- Jobs are paused, not lost, when you switch them off.
- For one-off background work triggered by your app, use Background tasks (jobs) instead.
More guides in Console: functions, cron & jobs
Create and deploy a function
Write a function in the Console editor, choose a runtime and trigger, test it, and call it over HTTP.
Function secrets, webhooks and logs
Keep keys out of your code, protect a function with a signed webhook, and read or limit its execution logs.
Background tasks (jobs) with automatic retries
Hand slow or unreliable work to a background job that retries on its own, and watch its status in the Console.
Actions: named transactions with effects
Define a named SQL transaction once, call it from your app, an AI agent or a schedule, and trigger emails, queues and more after it commits.