From 5ae92854b7d8d2101ad612b8a23d02cea06ca27b Mon Sep 17 00:00:00 2001 From: "Kevin Veen-Birkenbach [aka. Frantz]" Date: Tue, 29 Mar 2022 19:56:41 +0200 Subject: [PATCH] Renamed variables --- .../files/pull-remote-backup.sh | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/roles/native-pull-primary-backups/files/pull-remote-backup.sh b/roles/native-pull-primary-backups/files/pull-remote-backup.sh index b7630c93..393f1118 100644 --- a/roles/native-pull-primary-backups/files/pull-remote-backup.sh +++ b/roles/native-pull-primary-backups/files/pull-remote-backup.sh @@ -9,28 +9,28 @@ source_machine_id="$( (ssh "$source_host" sha256sum /etc/machine-id) | head -c 6 source_path="/Backups/$source_machine_id/" directories="$(ssh "$source_host" find "$source_path" -maxdepth 1 -type d)" || exit 1 -for folder in $directories; do - if [ "$folder" != "$source_path" ]; then +for backup_type_dir in $directories; do + if [ "$backup_type_dir" != "$source_path" ]; then # this folder is neccessary to make restricted rsync possible: - diff_current="$folder/diffs/current/" - # this is the folder where the diffs will be copied to: - diff_store="$folder/diffs/$(date '+%Y%m%d%H%M%S')/" + current_version="$backup_type_dir/versions/current/" + # this is the folder where the versions will be copied to: + diff_store="$backup_type_dir/versions/$(date '+%Y%m%d%H%M%S')/" # this is the folder which contains the actual backup: - latest_path="$folder/latest/" + latest_path="$backup_type_dir/latest/" # source path of the backup files: remote_source_path="$source_host:$latest_path" # file in which the logs will be saved: - log_path="$folder/log.txt" + log_path="$backup_type_dir/log.txt" # create working folders: mkdir -vp "$latest_path" mkdir -vp "$diff_store" - rm -vr "$diff_current" - mkdir -vp "$diff_current" + rm -vr "$current_version" + mkdir -vp "$current_version" # do backup: - rsync -abP --delete --delete-excluded --rsync-path="sudo rsync" --log-file="$log_path" --backup-dir="$diff_current" "$remote_source_path" "$latest_path" || ((errors+=1)); - mv -v "$diff_current"* "$diff_store" + rsync -abP --delete --delete-excluded --rsync-path="sudo rsync" --log-file="$log_path" --backup-dir="$current_version" "$remote_source_path" "$latest_path" || ((errors+=1)); + mv -v "$current_version"* "$diff_store" fi done exit $errors;