From efb607aff84d2cad2635ffc8ed0f229953a1ae7e Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Tue, 21 Apr 2020 18:23:41 +0200 Subject: [PATCH] Fix something with local dir creation --- backup2me.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backup2me.sh b/backup2me.sh index ae23c2a..f60f04f 100755 --- a/backup2me.sh +++ b/backup2me.sh @@ -55,7 +55,11 @@ RSYNC_STRUCTURE_CMD=${RSYNC_BASE_CMD[*]} RSYNC_STRUCTURE_CMD+=(--relative $BACKUP_CONTENTS_PATH $BACKUP_TARGET) RSYNC_DATA_CMD=${RSYNC_BASE_CMD[*]} -RSYNC_DATA_CMD+=(--delete --inplace $BACKUP_EXCLUSIONS --backup --backup-dir=../$BACKUP_ARCHIVE $BACKUP_DIRECTORY $BACKUP_TARGET/$BACKUP_CONTENTS_PATH) +RSYNC_DATA_CMD+=(--delete --inplace $BACKUP_EXCLUSIONS) +if [ ! -z "$BACKUP_ARCHIVE" ]; then + RSYNC_DATA_CMD+=(--backup --backup-dir=../$BACKUP_ARCHIVE) +fi +RSYNC_DATA_CMD+=($BACKUP_DIRECTORY $BACKUP_TARGET/$BACKUP_CONTENTS_PATH) echo "Starting backup. Target: $BACKUP_BASE_PATH. Archive: $BACKUP_ARCHIVE" @@ -66,6 +70,7 @@ echo "Done" ### Create local model of the remote's backup directory tree and send it ### echo "Directory structure..." +cd ~/ mkdir -p "$BACKUP_CONTENTS_PATH" eval ${RSYNC_STRUCTURE_CMD[*]} || exit 1 echo "Done"