Scheduled Tasks

Run commands on a schedule inside your egg — no always-on server required.

How it works

A scheduled task (cron) runs your command on a recurring schedule inside your egg's last deployed image, with the same environment variables and addons as your app — but with no public route.

Each run is fully isolated: a failing or looping cron never affects your main app. It runs as a separate sandboxed job (read-only root filesystem, non-root, dropped capabilities) — the same security base as your egg.

Schedule syntax

Schedules use standard 5-field cron syntax (minute granularity, evaluated in UTC):

*/5 * * * *Every 5 minutes
0 * * * *Every hour, on the hour
0 3 * * *Every day at 03:00 UTC

Limits: minimum effective interval 1 minute (no seconds), up to 10 crons per egg, command up to 1024 characters.

Create and manage tasks

Manage scheduled tasks from the CLI. Everything after -- is the command that runs on the schedule:

# Register a cron on the current egg
hatch cron add "*/5 * * * *" -- echo hello

# List crons (schedule, command, last/next run)
hatch cron list

# View logs for a cron (latest run by default)
hatch cron logs <cron-id>

# Remove a cron
hatch cron rm <cron-id>

To change a schedule, remove the cron and add it again with the new schedule.

Energy metering

Cron runs consume energy just like normal egg runtime — each run's duration counts against your egg's daily and weekly energy budget. When the budget is depleted, the next scheduled run is skipped (no compute is dispatched) and recorded as skipped_depleted. Boosted and Always On eggs are not subject to this limit.

Run history & logs

Hatch keeps the most recent runs for each cron (status, exit code, and timestamps). Use hatch cron list to see the last and next run, and hatch cron logs for a run's stdout/stderr. The same history is available via the API at GET /v1/apps/{slug}/crons/{id}/runs.

Hatch mascot