> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduled commands

> Run one site command on a recurring cron and inspect its output.

A scheduled command runs an existing site command on a cron. Use it for a direct, repeatable task such as validation or a repository script.

Give an [agent](/docs/studio/ai-chat.md#give-an-agent-a-job) a routine instead when the work needs tools or judgment.

## Create a schedule

```bash theme={null}
fimo schedules create nightly --cron "0 2 * * *" --do "fimo validate"
```

Cron uses standard five-field syntax. Fimo runs the command from the site root in the selected Branch. The current checkout selects the Branch by default, or you can pass `--branch <name>`. Schedules cannot run on `prod`: it only holds what you published. Schedule the Branch you publish from, usually `main`.

The schedule policy shown by `list` and `show` is the source of truth for the current cadence and availability.

## Select site secrets

Schedules receive no site secrets unless you select them. Repeat `--secret` for the keys the command needs:

> [tab] npm
>
> ```bash theme={null}
> fimo schedules create content-sync \
>   --cron "0 * * * *" \
>   --do "npm run sync:content" \
>   --secret CMS_TOKEN
> ```

> [tab] Bun
>
> ```bash theme={null}
> fimo schedules create content-sync \
>   --cron "0 * * * *" \
>   --do "bun run sync:content" \
>   --secret CMS_TOKEN
> ```

> [tab] pnpm
>
> ```bash theme={null}
> fimo schedules create content-sync \
>   --cron "0 * * * *" \
>   --do "pnpm sync:content" \
>   --secret CMS_TOKEN
> ```

> [tab] Yarn
>
> ```bash theme={null}
> fimo schedules create content-sync \
>   --cron "0 * * * *" \
>   --do "yarn sync:content" \
>   --secret CMS_TOKEN
> ```

## Manage schedules

```bash theme={null}
fimo schedules list
fimo schedules show nightly
fimo schedules update nightly --cron "0 3 * * *"
fimo schedules pause nightly
fimo schedules resume nightly
fimo schedules delete nightly
```

Pausing stops future cron runs and keeps the schedule history.

Fimo suspends a schedule after three consecutive failed runs on the same Branch, regardless of the error. This includes failures while preparing the run, missing secrets, command errors, and timeouts. A successful run resets the streak. Skipped ticks do not count either way.

A suspended schedule keeps its active-schedule slot but does not start more runs. Review the latest failure, fix the cause, then use **Resume** in Studio or `fimo schedules resume <name>`. Resume gives the schedule a fresh retry streak. Editing an unsuspended schedule also starts a fresh streak. A new deployment does not resume a suspended schedule.

## Run and inspect

```bash theme={null}
fimo schedules run nightly
fimo schedules runs nightly --limit 25
fimo schedules runs nightly --status failed
fimo schedules runs nightly --cursor <next-cursor>
fimo schedules runs nightly --all-pages
fimo schedules runs show <run-id>
```

`run` waits for completion by default. Add `--no-wait` to return after Fimo queues it. Only one run for a schedule can be active at a time.

Each run can last up to the **Max run time** shown in the schedule policy. If the command is still running at that limit, Fimo stops it, keeps the output it produced so far, and marks the run failed with the error code `deadline_exceeded`.

> [!WARNING]
>
> A scheduled command may run more than once. Make commands with external side effects safe to retry.

## What's next

> [card] [Automate your site](/docs/automate/overview.md)
>
> Choose the right automation tool.

> [card] [Agents](/docs/studio/ai-chat.md#give-an-agent-a-job)
>
> Give work that needs judgment to an agent.

> [card] [Branches](/docs/environments/overview.md)
>
> Keep scheduled work isolated.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.