Fluxon Docs
Batteries

cron — scheduling

Schedule work with standard Unix 5-field cron expressions, no quotes needed.

A standard Unix 5-field cron expression: minute hour day month weekday. Every AI agent knows this format (crontab, GitHub Actions, ...). cron.on reads the expression without quotes — here * is not multiplication, it is a cron marker:

use cron
cron.on 0 * * * * check_prices    # at the start of every hour (minute=0)
cron.on 30 9 * * * daily_check    # every day at 09:30
cron.on 0 18 * * 0 briefing       # Sunday (0) at 18:00
cron.on */15 * * * * poll         # every 15 minutes
cron.on 0 9 * * 1-5 \->           # weekdays at 09:00 (inline lambda)
  log "weekday"

Fields: * any value, */N every N, A-B a range, A,B,C a list. Weekday: 0=Sunday ... 6=Saturday.

cron.on does not block — like http.on it just registers, and the scheduler runs in the background. A server (http.serve/ws.serve) keeps the process alive, and cron runs in the background at its scheduled times. Order: cron.on calls go before http.serve.

For a cron-only script (no server) — cron.run takes over the process:

cron.on 0 9 * * * daily_check
cron.run                          # blocks: the program does not end, cron keeps running

Convenience: you can also write the expression with quotes (cron.on "0 9 * * *" f) — the result is the same. For an AI the canonical form is without quotes (fewer tokens).