From 60e2c1979e2e230b36b0542f3746207c96ff58c8 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 5 Feb 2023 14:28:37 +0100 Subject: [PATCH] Add support for excludes-file Signed-off-by: Knut Ahlers --- docker-entrypoint.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index ba318d9..b258e13 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,6 +2,7 @@ set -euo pipefail : ${BASE_DIR:=.} # Where to create the backup dir +: ${EXCLUDES_FILE:=} # File containing exclude globs : ${EXIT_ON_ERROR:=false} # Exit on backup error (default keep running) : ${HETZNER_WORKAROUND:=false} # Hetzner StorageBox needs sftp for symlinks : ${INTERVAL:=3600} # When to backup (3600 = *:00, 1800 = *:00,30) @@ -155,9 +156,14 @@ function run_backup() { } info "Synchronizing backup..." + extra_params=() + + [[ -z $EXCLUDES_FILE ]] || extra_params+=("--exclude-from=${EXCLUDES_FILE}") + rsync -av --delete \ "${LOCAL_DIR}/" \ --link-dest "../${LATEST_LINK}/" \ + "${extra_params[@]}" \ "${REMOTE_HOST}:${dest}/" || { error "Failed to sync backup-dir." return 1