backup
Run and list database backups.
backup run
Run a backup immediately, outside of the normal schedule.
opsvault backup run [database-name] [flags]Run all enabled databases:
opsvault backup runRun a single database by name:
opsvault backup run myapp_prodOutput
✓ myapp_prod (1.8s)
/var/backups/opsvault/myapp_prod_20240115_020001.sql.gz
✗ analytics (0.3s)
starting pg_dump: exec: "pg_dump": executable file not found in $PATHbackup run processes every database even if one fails — it does not stop on the first error. The exit code is 1 if any database failed.
What happens during a run
- For each enabled database:
- Runs
mysqldumporpg_dumpand pipes output through gzip - Writes to a
.tmpfile first, then renames atomically to prevent partial files
- Runs
- If rclone is enabled: uploads to the configured remote
- If local retention is enabled: prunes old local files
- If remote retention is enabled: prunes old remote files
- Sends notifications (if configured)
Global flags
--config string path to config file (default: /etc/opsvault/config.yaml)backup list
List the local backup files stored in backup_dir.
opsvault backup list [flags]Output
FILE SIZE MODIFIED
myapp_prod_20240115_020001.sql.gz 4.2 MB 2024-01-15 02:00
myapp_prod_20240114_020001.sql.gz 4.1 MB 2024-01-14 02:00
myapp_prod_20240113_020001.sql.gz 4.0 MB 2024-01-13 02:00Files created in the last 24 hours are highlighted in green.
backup history
Show the history of past backup runs — successes and failures — with duration, file size, and timestamps.
opsvault backup history [flags]Output
DATABASE STATUS SIZE DURATION STARTED AT
────────────────────────────────────────────────────────────────────────
myapp_prod success 4.2 MB 1.8s 2024-01-15 02:00:01
analytics success 1.1 MB 0.9s 2024-01-15 02:00:03
myapp_prod failed - 0.2s 2024-01-14 02:00:01
└─ starting pg_dump: exec: "pg_dump": executable file not found in $PATH
myapp_prod success 4.1 MB 1.7s 2024-01-13 02:00:01Flags
| Flag | Default | Description |
|---|---|---|
-n, --limit | 50 | Maximum number of entries to show |
--db | (all) | Filter by database name |
Storage
History is stored as newline-delimited JSON in <backup_dir>/.history.jsonl. Each backup run appends one entry. The file is never truncated automatically — use --limit to cap the output.