# How to run a daily job in an app Claude built

Add a scheduled job to an app Claude or Claude Code built: one cron block in floo.app.toml runs a command in the app's own image on a schedule, with the app's database and secrets. How to write it, test it, and watch it.

Canonical URL: https://getfloo.com/blog/how-to-run-a-daily-job-in-an-app-claude-built

## TL;DR

**To run a daily job in an app Claude built, add a `[cron.&lt;name&gt;]` block to `floo.app.toml` with a schedule and a command. floo runs the command in the app's own image, in UTC, with the same database and secrets as the app. Test it now with `floo cron run`.**

- No separate scheduler service, no second deployment.
- The job reads the same `DATABASE_URL` and secrets as the web app.
- Each run has a status and logs your agent can read.

The second thing most apps need, after a page people open, is something that happens without anyone opening it: the morning summary, the nightly cleanup, the reminder on Friday. Claude can write that code in a minute. The question is where it runs.

## 1. Have Claude write the job as a command

A scheduled job is a command that does its work and exits. Ask for it that way:

> Write scripts/daily-summary.js. It reads yesterday's orders from Postgres and posts a summary to our team chat webhook. Read the webhook URL from the CHAT_WEBHOOK_URL environment variable. Exit with an error if anything fails.

Two details make jobs reliable: read secrets from the environment, and exit non-zero on failure so the run shows as failed.

## 2. Add the schedule

```toml floo.app.toml
[cron.daily-summary]
schedule = "0 13 * * *"
command = "node scripts/daily-summary.js"
service = "web"
timeout = 300
```

- **schedule** is a standard cron expression in UTC. `0 13 * * *` is 1pm UTC, 8am in New York in winter.
- **command** runs in the image of the service you name, so the job has the same code, packages, and runtime as the app.
- **timeout** is the most seconds a run may take, up to 1500.

Store the secret once:

```bash
floo env set CHAT_WEBHOOK_URL --stdin --app orders-app
```

Push, and the next deploy creates the job. `floo deploy --preflight` rejects an invalid schedule before you push.

## 3. Test it now

Don't wait until tomorrow morning:

```bash
floo cron run daily-summary --app orders-app
floo logs --cron daily-summary --app orders-app
floo cron list --app orders-app
```

`cron list` shows every job with its schedule and how its last run went. Claude Code can run the same commands with `--json` and fix the script when a run fails.

## Common daily jobs

- **Summaries.** Yesterday's signups, orders, or tickets, posted to chat or email.
- **Reminders.** Renewals due this week, approvals waiting more than two days.
- **Syncs.** Pull new rows from another system's API into Postgres.
- **Cleanup.** Delete expired sessions, archive old records.

## Things to get right

- **Make it safe to run twice.** A manual `floo cron run` or an overlapping run should not send the summary twice or double-count. floo does not retry failed runs on its own. Record what each run did.
- **Keep it short.** A job that takes longer than its timeout is stopped. Split big work into batches.
- **Dev and prod each run it.** An app with a prod environment has a copy of each job there too, with prod's data. Point test runs at dev.

The full field list is in the [cron jobs guide](https://getfloo.com/docs/guides/cron-jobs). For the app around the job, see [how to deploy an app built with Claude Code](https://getfloo.com/blog/how-to-deploy-an-app-built-with-claude-code). To decide whether work belongs in a job, a background worker, or the web service, see [web service vs worker vs cron job](https://getfloo.com/blog/web-service-vs-worker-vs-cron-job).

## FAQ

### How do I schedule a job in an app Claude Code built?

Add a [cron.<name>] block to floo.app.toml with a schedule, a command, and the service whose image runs it. Push, and floo runs the command on that schedule in UTC, with the app's database and secrets.

### How do I test a scheduled job without waiting for it?

Run floo cron run <name> --app <app> to start it now, then floo logs --cron <name> --app <app> to read its output. floo cron list shows every job and how its last run went.

### What time zone do floo cron jobs use?

UTC. A job for 8am in New York in winter is "0 13 * * *". If the time must follow daylight saving, run the job hourly and have the code check the local time.
