diff options
| author | Robert Günzler <r@gnzler.io> | 2025-09-07 17:32:13 +0200 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2025-09-07 17:42:42 +0200 |
| commit | 38be6c13f76e893cf47636257071b440dec0c5b2 (patch) | |
| tree | f7ded3235a7e3362cbd1ed3d91523968fe0faf90 /bundles/restic-backup/files/resticbackup | |
initial commit
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'bundles/restic-backup/files/resticbackup')
| -rw-r--r-- | bundles/restic-backup/files/resticbackup | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/bundles/restic-backup/files/resticbackup b/bundles/restic-backup/files/resticbackup new file mode 100644 index 0000000..af61d7e --- /dev/null +++ b/bundles/restic-backup/files/resticbackup @@ -0,0 +1,36 @@ +#!/bin/sh +set -eu + +backup_includes=/etc/restic/includes +backup_excludes=/etc/restic/excludes +backup_tag=foobar +backup_keep=1m + +main() { + # remove stale locks + resticw unlock + + # run backup + resticw backup \ + --one-file-system \ + --files-from "${backup_includes}" \ + --exclude-file "${backup_excludes}" \ + --tag "${backup_tag}" + + # prune backups older than $backup_keep duration + resticw forget \ + --keep-within "${backup_keep}" \ + --prune \ + --group-by "paths,tags" \ + --tag "${backup_tag}" + + # TODO: restic check + # TODO: dump stats to file in metrics format to /run/prom/restic +} + +exit_hook() { + resticw unlock +} +trap exit_hook INT EXIT + +main |