💾 Backup
crestic backup [--all, -a] [--pipeline, -p <name>] [--job, -j <pipeline/job>] [--dry-run] [--healthcheck]Performs backup and copy jobs from your configuration.
backup supports two execution modes:
--pipeline/--all: runs full pipelines (all jobs in pipeline order)--job: runs only explicitly selected jobs
What It Does
The backup command performs a complete backup workflow (all steps are automatic):
- Sends start ping to healthcheck service (pipeline runs with
--healthcheckandhealthcheck_url) - Runs
beforehooks (if configured) - Checks repository - automatically initializes if not exists
- Creates backup - encrypted, deduplicated snapshot
- Verifies integrity - runs
restic checkon repository - Applies retention policy - runs
restic forgetwithforget_options - Runs
successorfailurehooks based on outcome - Sends success/failure ping to healthcheck service (same conditions as step 1)
Healthcheck pings apply only to --pipeline / --all runs, not --job.
Examples
# All jobs from all pipelines
crestic backup --all
# Entire pipeline
crestic backup --pipeline documents-nightly
# With healthchecks
crestic backup --pipeline documents-nightly --healthcheck
# Specific job (qualified name: pipeline/job)
crestic backup --job documents-nightly/local-backup
# Multiple jobs
crestic backup --job documents-nightly/local-backup,photos-weekly/backup
# Dry run
crestic backup --all --dry-runOnly one of --all, --pipeline, or --job can be specified at a time.
Automatic Cleanup
If your repository has forget_options configured, old snapshots are automatically removed after each backup:
repositories:
my-repo:
forget_options:
keep-daily: 7
keep-weekly: 4
prune: true # Actually frees disk spaceFor more options, see Removing backup snapshots (opens in a new tab).
Error Handling
Jobs in a list run sequentially (fail-fast). If one job fails:
- The error is logged and returned immediately
- Remaining jobs in the same list are not executed
When running multiple pipelines (--all or several --pipeline values), each pipeline
still runs even if a previous pipeline failed; pipeline-level errors are combined at the end.