mirror of
https://github.com/luzifer-docker/pvc-rsync.git
synced 2024-12-20 19:21:16 +00:00
Add support for excludes-file
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
da333914f8
commit
60e2c1979e
1 changed files with 6 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
: ${BASE_DIR:=.} # Where to create the backup dir
|
: ${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)
|
: ${EXIT_ON_ERROR:=false} # Exit on backup error (default keep running)
|
||||||
: ${HETZNER_WORKAROUND:=false} # Hetzner StorageBox needs sftp for symlinks
|
: ${HETZNER_WORKAROUND:=false} # Hetzner StorageBox needs sftp for symlinks
|
||||||
: ${INTERVAL:=3600} # When to backup (3600 = *:00, 1800 = *:00,30)
|
: ${INTERVAL:=3600} # When to backup (3600 = *:00, 1800 = *:00,30)
|
||||||
|
@ -155,9 +156,14 @@ function run_backup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
info "Synchronizing backup..."
|
info "Synchronizing backup..."
|
||||||
|
extra_params=()
|
||||||
|
|
||||||
|
[[ -z $EXCLUDES_FILE ]] || extra_params+=("--exclude-from=${EXCLUDES_FILE}")
|
||||||
|
|
||||||
rsync -av --delete \
|
rsync -av --delete \
|
||||||
"${LOCAL_DIR}/" \
|
"${LOCAL_DIR}/" \
|
||||||
--link-dest "../${LATEST_LINK}/" \
|
--link-dest "../${LATEST_LINK}/" \
|
||||||
|
"${extra_params[@]}" \
|
||||||
"${REMOTE_HOST}:${dest}/" || {
|
"${REMOTE_HOST}:${dest}/" || {
|
||||||
error "Failed to sync backup-dir."
|
error "Failed to sync backup-dir."
|
||||||
return 1
|
return 1
|
||||||
|
|
Loading…
Reference in a new issue