From 5e30c74a138ce02abaf573e0dcea0346d6506801 Mon Sep 17 00:00:00 2001 From: Clemens Geibel Date: Mon, 1 Mar 2021 11:34:59 +0100 Subject: [PATCH] Added function to backup multiple sub-directories --- .../docker/image/resources/file-functions.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/infrastrucure/docker/image/resources/file-functions.sh b/infrastrucure/docker/image/resources/file-functions.sh index defbdcf..743135f 100644 --- a/infrastrucure/docker/image/resources/file-functions.sh +++ b/infrastrucure/docker/image/resources/file-functions.sh @@ -13,6 +13,17 @@ function backup-directory() { restic -v -r ${RESTIC_REPOSITORY}/files forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune } +# First arg is the directory, the remaining args are the sub-directories (relative to the first directory) to backup. +function backup-fs-from-directory() { + local directory="$1"; shift + + restic -v -r ${RESTIC_REPOSITORY}/files unlock --cleanup-cache + + cd ${directory} && restic -v -r ${RESTIC_REPOSITORY}/files backup $@ + + restic -v -r ${RESTIC_REPOSITORY}/files forget --keep-last 1 --keep-within ${RESTIC_DAYS_TO_KEEP}d --prune +} + function restore-directory() { local directory="$1"; shift