Skip to main content
Version: v5.8.0

opschain maintenance schedule

maintenance

opschain maintenance schedule <path>
(--window <from>/<to>|<duration> | --from <time> --to <time>)
--reason <text> [--allow-workflow w]... [--allow-action a]...
[--allow-user u]... [--run <workflow>]... [--auto-extend 15m]
[--max-extension 2h] [--auto-end]

Creates a maintenance window the server starts and ends by itself: it opens at --from and closes at --to — a hard end, unlike a manual window's advisory intent. Only one window — active or scheduled — can exist per node at a time, and a scheduled window that has not started yet is removed with opschain maintenance cancel.

The window can carry its own work: each --run workflow is started at the window's opening, as you, and counts as the window's own (allowlisted, stamped) work. Two knobs tie the end to that work:

  • --auto-extend <d> keeps pushing the hard end out by <d> while the window's work is still running — up to --max-extension (2h unless set), after which the window ends anyway with a warning;
  • --auto-end closes the window as soon as all its work has finished, whatever the outcome, instead of waiting for the hard end.

Relative windows​

The span is given either as --from and --to or at once as --window <from>/<to>. Each time is an RFC3339 time with a zone (2026-10-17T12:00:00Z), now, or an offset from now (+10m, +2h — a Go duration with its sign), in any mix; --window also takes a bare duration (2h), which means from now for that long. Relative times are resolved on this machine's clock and sent as UTC, so --window +10s/+90s replaces any date arithmetic. A time without a zone is refused (add Z or an offset, or use a relative form), and so is a window that ends at or before it starts.

Durations are passed to the server as whole seconds. Prints scheduled maintenance on <path> from <from> to <to> (window <id>) with the resolved times, then the span sent — window <from>/<to> (UTC); -o json / -o yaml emit the window document.

Flags​

FlagMeaning
--reason <text>Why the subtree will be quiesced. Required.
--from <time>When the window starts: RFC3339 with a zone, now, or an offset such as +10m. With --to, unless --window is given.
--to <time>When the window ends — the hard end the server enforces: RFC3339 with a zone, now, or an offset such as +2h. With --from, unless --window is given.
--window <from>/<to>|<duration>The span at once, in the --from/--to forms (e.g. +10m/+2h), or a bare duration from now (e.g. 2h). Not with --from/--to.
--allow-workflow <code>Workflow code admitted through the window (repeatable).
--allow-action <action>Change action admitted through the window (repeatable).
--allow-user <username>Username admitted through the window (repeatable).
--run <workflow>Workflow to start when the window opens, run as you (repeatable).
--auto-extend <d>Keep extending the window by this much (e.g. 15m) while its work is unfinished.
--max-extension <d>Cap on the total automatic extension (e.g. 2h); 2h unless set.
--auto-endEnd the window as soon as all its work has finished, whatever the outcome.

Exit codes​

CodeMeaning
0Window scheduled.
1The server refused — e.g. a window already exists on the node, or missing rights.
2Usage error.

Named errors​

  • required flag(s) "reason" not set — exit 2.
  • give the window's span: --window <from>/<to> or a duration (…), or both --from and --to — exit 2.
  • --window gives the span --from and --to give: pass one or the other — exit 2.
  • --from wants an RFC3339 timestamp like 2026-10-12T22:00:00Z, now or an offset like +10m: <parse error> (same shape for --to) — a time without a zone reads "…" has no time zone: add Z or an offset (…), or use a relative form like now/+2h; exit 2.
  • --to (…) is at or before --from (…): a window must be longer than zero and --window ends at or before it starts (…) — exit 2.
  • --auto-extend wants a positive duration like 15m or 1h (same shape for --max-extension) — exit 2.
  • expected a node path like demo/environments/dev, got "" — exit 2.

Examples​

A Saturday-night window that runs the upgrade itself and closes as soon as it finishes:

opschain maintenance schedule acme/environments/prod \
--from 2026-10-17T12:00:00Z --to 2026-10-17T14:00:00Z \
--reason "db engine upgrade" \
--run db_upgrade --auto-extend 15m --max-extension 1h --auto-end
scheduled maintenance on /projects/acme/environments/prod from 2026-10-17T12:00:00Z to 2026-10-17T14:00:00Z (window 01999a7e-…)
window 2026-10-17T12:00:00Z/2026-10-17T14:00:00Z (UTC)

A patch window starting in ten minutes and lasting until two hours from now:

opschain maintenance schedule acme/environments/dev --window +10m/+2h --reason "os patching"
scheduled maintenance on /projects/acme/environments/dev from 2026-11-20T07:40:00Z to 2026-11-20T09:30:00Z (window 01a1…)
window 2026-11-20T07:40:00Z/2026-11-20T09:30:00Z (UTC)

See also​

  • opschain docs cli/maintenance-cancel — removing it before it starts.
  • opschain docs cli/maintenance-extend — moving the hard end by hand.
  • opschain learn 5.6 — the full window lifecycle.