Skip to content
Get started
Get started
Cron Reference: Expressions, Options, MCP
View Markdown
guide · cron jobs

Every field, every option.

The expression syntax with its shortcuts, the full repeat option table with defaults and the naming each SDK uses, plus managing schedules through an AI agent.

Five fields, left to right: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-7; both 0 and 7 are Sunday).

ExpressionMeaning
0 9 * * *Every day at 9:00 AM
*/15 * * * *Every 15 minutes
0 0 * * MONEvery Monday at midnight
0 0 1 * *First day of every month

Shortcuts (@daily, @hourly, @weekly, @monthly, @yearly, @midnight) and a six-field form with a leading seconds field are also accepted. The seconds field supports values 0-59, *, lists, ranges and steps; for example, 0,30 * * * * * runs twice per minute. The five calendar fields are evaluated by Bun’s native cron parser.

Seven-field expressions with a year and the non-POSIX L, W, #, +, and ? modifiers are not supported.

Time zones and daylight-saving transitions

Section titled “Time zones and daylight-saving transitions”

The five calendar fields follow Bun 1.4’s native cron semantics in the selected IANA timezone. The leading-seconds adapter keeps the same calendar decision and then selects the requested second within that minute:

  • During spring-forward, a fixed time inside the missing hour moves forward by the DST gap (02:30 runs at 03:30). For a multi-minute pattern entirely inside the gap, only its first missing match fires after the jump.
  • During fall-back, a fixed time inside the repeated hour fires once, at the first occurrence. A pattern whose minute or hour field is * traverses both occurrences, once per matching real-time minute.

These rules intentionally match Bun and Linux cron behavior. They differ from Croner for some wildcard patterns in a repeated fall-back hour.

Options on the repeat object of upsertJobScheduler:

OptionDefaultDescription
pattern-Cron expression
every-Positive safe-integer interval in ms (alternative to pattern)
timezoneUTC (embedded) / server timezone (TCP)IANA timezone for pattern evaluation
limitunlimitedMax executions, then the scheduler is removed
immediatelyfalseFire once right away on first creation
skipIfNoWorkerfalseSkip a run when no worker is registered for the queue
preventOverlaptrueSkip a run while the previous job is still active
skipMissedOnRestarttrueOn server restart, recompute the next run instead of firing missed runs
Semantic optionBunNode.js / DenoPythonPHPGoRustElixir
cron patternpatternpatternpatternpatternPatternpatternpattern
intervaleveryeveryeveryeveryEveryMsevery_msevery
timezonetimezonetztztzTimezonetimezonetz or timezone
skip with no workerskipIfNoWorkerskipIfNoWorkerskip_if_no_workerskipIfNoWorkerSkipIfNoWorkerskip_if_no_workerskipIfNoWorker
missed-run policyskipMissedOnRestartskipMissedOnRestartskip_missed_on_restartskipMissedOnRestartSkipMissedOnRestart (*bool)server default onlyskipMissedOnRestart
overlap policypreventOverlappreventOverlapprevent_overlappreventOverlapPreventOverlap (*bool)server default onlypreventOverlap

Rust’s scheduler type currently omits skipMissedOnRestart and preventOverlap; both therefore use the server default true. Go uses pointer booleans for those two fields so explicit false is distinct from omission. addCron and every convenience helpers exist in TypeScript and Python only; PHP, Go, Rust, and Elixir use the scheduler API directly.

At least one timing field is required. If both pattern and a valid every value are supplied, pattern takes precedence for backward compatibility. The server rejects non-numeric, non-finite, non-integer, unsafe, zero, and negative intervals before changing the existing scheduler definition.

AI agents can manage cron jobs in natural language (“create a cron that cleans old sessions every hour”) through the MCP Server:

Terminal window
bun add bunqueue @modelcontextprotocol/sdk
claude mcp add bunqueue -- bunx --package=bunqueue bunqueue-mcp
Job Schedulers from the QueueNamed repeatable schedules on the Queue object
Cron Jobs in BunYour first schedule, in every SDK and from the CLI
Cron RecipesFixed intervals, timezones, repeat-after-completion