hardlink to latest incomplete backup too (2nd linkdest added)

This commit is contained in:
olli 2022-12-14 10:31:30 +01:00
parent 8a16ed58e3
commit 4ef0287961

View File

@ -116,10 +116,14 @@ var-lib-docker
BACKUPSRVPATH_WITH_HOST="$BACKUPSRVPATH/$(hostname)" BACKUPSRVPATH_WITH_HOST="$BACKUPSRVPATH/$(hostname)"
BACKUPSRVPATH_WITH_DATE="$BACKUPSRVPATH_WITH_HOST/backup-$(date +%Y-%m-%d)/$BACKUPDIR" BACKUPSRVPATH_WITH_DATE="$BACKUPSRVPATH_WITH_HOST/backup-$(date +%Y-%m-%d)/$BACKUPDIR"
BACKUPSRVPATH_WITH_DATE_INCOMPLETE="$BACKUPSRVPATH_WITH_DATE-incomplete" BACKUPSRVPATH_WITH_DATE_INCOMPLETE="$BACKUPSRVPATH_WITH_DATE-incomplete"
g_runcmd $sshopts mkdir -p "$BACKUPSRVPATH_WITH_DATE_INCOMPLETE" || continue
# linkdest/hardlink if present
BACKUPSRVPATH_LINK_DEST="$($sshopts ls -dtr1 "$BACKUPSRVPATH_WITH_HOST/backup-*/$BACKUPDIR" 2>/dev/null | tail -n1)" BACKUPSRVPATH_LINK_DEST="$($sshopts ls -dtr1 "$BACKUPSRVPATH_WITH_HOST/backup-*/$BACKUPDIR" 2>/dev/null | tail -n1)"
# linkdest BACKUPSRVPATH_LINK_DEST_INCOMPLETE="$($sshopts ls -dtr1 "$BACKUPSRVPATH_WITH_HOST/backup-*/$BACKUPDIR-incomplete" 2>/dev/null | grep -v $BACKUPSRVPATH_WITH_HOST/backup-$(date +%Y-%m-%d) | tail -n1)"
[ -n "$BACKUPSRVPATH_LINK_DEST" ] && rsyncoptsrun="$rsyncoptsrun --link-dest=$BACKUPSRVPATH_LINK_DEST" [ -n "$BACKUPSRVPATH_LINK_DEST" ] && rsyncoptsrun="$rsyncoptsrun --link-dest=$BACKUPSRVPATH_LINK_DEST"
[ -n "$BACKUPSRVPATH_LINK_DEST_INCOMPLETE" ] && rsyncoptsrun="$rsyncoptsrun --link-dest=$BACKUPSRVPATH_LINK_DEST_INCOMPLETE"
g_runcmd $sshopts mkdir -p "$BACKUPSRVPATH_WITH_DATE_INCOMPLETE" || continue
else else
BACKUPSRVPATH_WITH_DATE_INCOMPLETE="$BACKUPSRVPATH" BACKUPSRVPATH_WITH_DATE_INCOMPLETE="$BACKUPSRVPATH"
fi fi