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

# Cron jobs

> Schedule recurring tasks inside your app's containers.

Cron jobs run shell commands on a schedule, in UTC, inside a service's container image. Declare them in `floo.app.toml`; every deploy syncs them.

## Declare in config

Add `[cron.<name>]` sections to `floo.app.toml`:

```toml theme={null}
[app]
name = "my-app"

[cron.daily-report]
schedule = "0 9 * * *"                  # 9am UTC daily
command = "python scripts/daily_report.py"
service = "web"                          # which service's image to run in

[cron.cleanup]
schedule = "*/5 * * * *"                 # every 5 minutes
command = "node scripts/cleanup.js"
service = "worker"
timeout = 600                            # max seconds (default 300)

[services.web]
type = "web"
path = "."
port = 3000
ingress = "public"

[services.worker]
type = "worker"
path = "./worker"
ingress = "internal"
```

## Fields

| Field | Required | Description |
| - | - | - |
| `schedule` | yes | Standard cron expression (e.g. `"0 9 * * *"` for 9am daily, `"*/5 * * * *"` for every 5 minutes) |
| `command` | yes | Shell command to execute inside the container |
| `service` | yes | Name of the service whose image to run the command in. Must match a `[services.*]` entry |
| `timeout` | no | Max execution time in seconds (default: 300) |

## Deploy and verify

Push to GitHub or run `floo redeploy`. Each deploy creates new jobs, updates changed ones, and deletes removed ones.

```bash theme={null}
git push origin main && floo deploys watch --app my-app
```

Then verify:

```bash theme={null}
floo cron list --app my-app
```

## Manually trigger a job

```bash theme={null}
floo cron run daily-report --app my-app
```

## Common schedule expressions

| Expression | Meaning |
| - | - |
| `* * * * *` | Every minute |
| `*/5 * * * *` | Every 5 minutes |
| `0 * * * *` | Every hour |
| `0 9 * * *` | Daily at 9am UTC |
| `0 9 * * 1-5` | Weekdays at 9am UTC |
| `0 0 * * 0` | Weekly on Sunday at midnight UTC |
| `0 0 1 * *` | Monthly on the 1st at midnight UTC |

## How it works

1. You declare `[cron.<name>]` in `floo.app.toml`
2. A deploy reads the `[cron.*]` sections from `floo.app.toml` in the deployed commit
3. floo creates, updates, or deletes cron job records to match the declarations
4. Jobs run inside the specified service's container image with the same environment variables

A job sees the same `DATABASE_URL`, `REDIS_URL`, and other env vars as the service it runs in.

## Failure handling

Cron jobs **do not retry**. Each scheduled run executes once; if the command exits non-zero or exceeds its `timeout`, that run is marked failed. The next scheduled run is the only recovery; there is no backoff.

Where a miss matters, make the command idempotent, handle retries inside it, and alert on failure: `floo logs query --app my-app --cron <job>` shows the cron output with `[cron:<job>]` attribution, and [agent webhooks](/docs/guides/agent-webhooks) can route repeated failures to your agent or on-call.

## Agent workflow

```bash theme={null}
# List cron jobs (JSON for parsing)
floo cron list --app my-app --json 2>/dev/null | jq '.data.cron_jobs'

# Trigger a job manually
floo cron run daily-report --app my-app --json 2>/dev/null
```

<Card title="CLI Reference" href="/docs/cli/cron">
  See the exact `floo cron list` and `floo cron run` flags, JSON shape, and `--preflight` behavior.
</Card>


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