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"