Jobs

jobs is an array of backup jobs. Each job has a cron schedule, one or more sources, one or more storages, and a retention policy.

Fields

FieldTypeRequiredNotes
namestringyesunique job name
schedulecronyes5-field cron — see Schedule
compressionenumnotar, tar.gz, tar.zst, tar.xz, zip — see Compression
sourcesarrayyesat least one — see Sources
storagesarrayyesat least one — see Storages
defaultStoragestringnoname of the storage flagged as default in the UI
retentionobjectyessee Retention
beforeScriptstringnoshell snippet executed before the job — see Hook scripts
afterScriptstringnoshell snippet executed after the job — see Hook scripts
encryptionobjectnosymmetric encryption — see Encryption
splitobjectnosplit the final archive into fixed-size parts — see Splitter
notifiersarraynoper-job notifications — see Notifiers

Schedule

Standard 5-field cron — minute hour day-of-month month day-of-week.

ExpressionMeaning
0 2 * * *every day at 02:00
*/15 * * * *every 15 minutes
0 3 * * 0every Sunday at 03:00
30 4 1 * *04:30 on the 1st of the month
0 0 * * 1-5midnight on weekdays

Even with a future-dated cron, a job can be triggered immediately from the UI (Run now) or via the REST API. Manual runs respect retention and notifiers exactly like scheduled runs. To disable manual runs, set server.permissions.allowManualRun: false.

Compression

ValueOutputParallelNotes
tar.tarno compression — use for already-compressed payloads
tar.gz.tar.gzyes¹classic gzip — best compatibility
tar.zst.tar.zstyeszstd with -T0 — best speed-vs-ratio trade-off
tar.xz.tar.xzyesxz with -T0 — highest ratio, slowest
zip.zipzip archive — handy for Windows recipients

¹ tar.gz uses pigz when it's on PATH (all cores); otherwise it falls back to single-threaded gzip transparently.

Aliases: gztar.gz, zst / zstdtar.zst, xztar.xz. Omit compression to use plain tar (no compression).

The official Docker image ships tar, pigz, zstd, xz, and zip preinstalled. On bare metal, install whichever compressor matches the formats you use — snapr returns a clear error at run time if a required binary is missing.

Retention

retention.last is required and must be at least 1. After every successful run snapr keeps the N newest archives for that job and deletes the rest from every storage attached to the job.

FieldTypeRequiredNotes
lastintyesnumber of archives to keep (≥ 1)
retention:
  last: 30

Hook scripts

beforeScript and afterScript run arbitrary shell commands around the job — quiesce a service, flush caches, post-clean. Both fields are optional and accept multi-line YAML strings.

beforeScript: |
  systemctl stop my-app
afterScript: |
  systemctl start my-app

afterScript runs whether the job succeeded or failed.

Example

jobs:
  - name: postgres-nightly
    schedule: '0 3 * * *'
    compression: tar.gz
    sources:
      - type: postgresql
        host: db.internal
        username: postgres
        password: env:PG_PASSWORD
        database: app
    storages:
      - name: nas
        type: local
        path: /var/backups
      - name: offsite
        type: s3
        bucket: backups
        region: us-east-1
        accessKeyId: env:S3_KEY
        secretAccessKey: env:S3_SECRET
    defaultStorage: offsite
    retention:
      last: 30
    beforeScript: |
      systemctl stop my-app
    afterScript: |
      systemctl start my-app
    encryption:
      type: openssl
      cipher: aes-256-cbc
      password: env:BACKUP_ENC_PASSWORD