> For the complete documentation index, see [llms.txt](https://docs.rootcause.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rootcause.ai/more-details/applications/application-modules/onschedule.md).

# On schedule

> Start a flow on a cron schedule, optionally spread over partition keys.

Starts a flow on a cron schedule.

`concurrency` decides what happens when a run is still going at the next fire — skip it, queue it, or replace it. `spread` staggers one logical fire across partition keys over `overMinutes`, so a thousand environments do not all start at 02:00; each partition arrives as its own run with its key on `partitionKey`. `catchUp` replays fires missed while the application was paused.

## At a glance

|                          |                        |
| ------------------------ | ---------------------- |
| Module type              | `OnSchedule`           |
| Category                 | Events                 |
| Default tier             | `durable`              |
| Runs on                  | `durable`              |
| Starts a flow            | yes                    |
| Holds a body             | no                     |
| Keeps state between runs | no                     |
| Available in             | every application type |

## Parameters

### `cron`

`string` · required · defaults to `"0 2 * * *"`

The schedule, as a cron expression.

### `concurrency`

`"replace" | "skip" | "queue"` · required · defaults to `"skip"`

What to do when the previous run is still going: skip this fire, queue it, or replace the run.

### `catchUp`

`boolean` · required · defaults to `false`

Replay fires that were missed while the application was paused.

### `timezone`

`string | null` · optional · defaults to `null`

Null means the organisation timezone.

### `spread`

`object` · optional · defaults to `null`

Stagger one fire across partition keys, so a large fleet does not all start at once. Give it `partitionBy` — a list of keys, or a dataset column to read them from — and `overMinutes` to spread across.

## Inputs

*None.*

## Outputs

| Port           | Kind               | Connects to                        | Description                                                                                                                                                            |
| -------------- | ------------------ | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event`        | `event`            | `event`, `json`                    | The event envelope: `{kind, at, payload}`.                                                                                                                             |
| `firedAt`      | `scalar<datetime>` | `scalar`, `json`, `text`, `signal` | When this run fired. The envelope's `at`, stamped as the run arrives, so a spread or a caught-up fire carries the instant it really ran and not the nominal cron time. |
| `partitionKey` | `scalar<string>`   | `scalar`, `json`, `text`, `signal` | The partition this run covers, when `spread` is set.                                                                                                                   |

***

[← All application modules](/more-details/applications/application-modules.md)
