From 38be6c13f76e893cf47636257071b440dec0c5b2 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Sun, 7 Sep 2025 17:32:13 +0200 Subject: initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- bundles/restic-backup/files/resticbackup | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 bundles/restic-backup/files/resticbackup (limited to 'bundles/restic-backup/files/resticbackup') 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 -- cgit 1.4.1