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

# Schedules

> A deployed function with a cron expression, run at set times in UTC.

A schedule fits recurring work such as a nightly report or an hourly cleanup.
Each scheduled run is a [task](/concepts/tasks-and-logs) with its own result
and logs.

## Define a schedule

This function counts files in a volume every day at 03:00 UTC. Save it as
`daily_report.py`:

```python theme={null}
from pathlib import Path

from lazycloud import App, Volume

app = App("daily_report")
uploads = Volume("report-inputs", "/inputs")


@app.function(name="count-files", cron="0 3 * * *", volumes=[uploads])
def count_files() -> dict[str, int]:
    count = sum(1 for path in Path("/inputs").rglob("*") if path.is_file())
    print(f"Stored files: {count}", flush=True)
    return {"files": count}
```

## Trigger it

Deploying the function registers its schedule:

```bash theme={null}
uv run lazycloud deploy daily_report:count_files
```

One run right now, without waiting for the schedule:

```bash theme={null}
uv run lazycloud run daily_report:count_files
```

The first run creates the declared volume or reuses an existing one. While the
volume is empty, the function returns `{"files": 0}`. Upload files to
`report-inputs` and the next run counts them. Scheduled runs appear in the
dashboard and in `uv run lazycloud task list --app daily_report`.

## Choose a schedule

All schedules use UTC.

| When                 | Value            |
| -------------------- | ---------------- |
| Every 15 minutes     | `"*/15 * * * *"` |
| Mondays at 03:00 UTC | `"0 3 * * 1"`    |
| Once an hour         | `"@hourly"`      |
| Every five minutes   | `"every 5m"`     |

Other aliases are `@daily`, `@midnight`, `@weekly`, `@monthly`,
`@yearly`, and `@annually`. Intervals accept up to 59 minutes, 23 hours, or
31 days. Deploy rejects an invalid expression.

## Schedule options

Scheduled runs use the function's timeout and
[retry](/concepts/functions#retries-and-timeouts) settings. A run that
overlaps the previous one queues behind it unless the function has
`concurrency` or an [autoscaler](/concepts/scaling) that lets them run side by
side. Scheduled functions default to `keep_warm=0`, so the container stops as
soon as a run finishes. See [Warm containers](/concepts/scaling#warm-containers).

## Change or stop the schedule

Editing `cron` and deploying again replaces the schedule. Removing `cron` and
redeploying keeps the function callable without automatic runs.

To stop it now:

```bash theme={null}
uv run lazycloud deployment stop count-files
```

`uv run lazycloud deployment delete count-files` removes it entirely. The
`report-inputs` volume and its files stay until you delete the volume.

## Shared settings

A schedule is a function, so the
[function options](/concepts/functions#function-options),
[Images](/concepts/images), [Resources and options](/concepts/resources), and
[Scaling and concurrency](/concepts/scaling) all apply.
