Skip to main content
Cron specs define scheduled jobs — backups, syncs, and other maintenance tasks — for a specific context. Once a spec is configured, use render-systemd to generate the systemd units and install them on the host.

cron

Cron specs define scheduled jobs for a sitectl context. Each spec records which context to run on, what schedule to use, which job components to run, and where to store output. Use render-systemd to turn a spec into systemd units you can install on the host.
sitectl cron <command>

add

Create or update a cron spec with the given name. A cron spec stores the schedule, target context, job components, output directory, and retention policy for a scheduled job. Once saved, use render-systemd to generate the systemd units and install them on the host.
sitectl cron add NAME
FlagDefaultDescription
--component[]Job component to include. Repeat to select multiple.
--cron-contextsitectl context this cron spec will execute against.
--docker-prunefalseRun docker system prune -af after a successful run.
--output-dirHost directory where dated output artifacts are stored.
--preserve-first-of-monthtrueKeep artifacts created on day 01 of the month when pruning.
--retention-days14Delete non-monthly artifacts older than this many days.
--schedulesystemd OnCalendar expression, e.g. daily or --* 03:00:00.

list

List configured cron specs
sitectl cron list

delete

Delete a cron spec
sitectl cron delete NAME

run

Run a configured cron spec now
sitectl cron run NAME

installed

List installed sitectl systemd cron units on a context host
sitectl cron installed

components

List available cron components for the active or selected context
sitectl cron components

render-systemd

Print the systemd .service and .timer unit files for the named cron spec, along with step-by-step instructions for installing them on the target host. For remote contexts, copy the units to the host manually and install them there.
sitectl cron render-systemd NAME

Typical workflow

  1. Check what job components are available for the context:
    sitectl cron components --context prod
    
  2. Create a spec:
    sitectl cron add nightly-backup \
      --cron-context prod \
      --schedule "daily" \
      --component db-backup \
      --output-dir /var/backups/sitectl
    
  3. Preview the systemd units and install them:
    sitectl cron render-systemd nightly-backup