Fix forget for backupdir '.'

This commit is contained in:
madmaurice 2017-10-28 10:53:29 +02:00 committed by Hive
parent a218211423
commit b2d3172c7f
1 changed files with 8 additions and 3 deletions

View File

@ -87,10 +87,15 @@ fi
export RESTIC_PASSWORD=${BACKUP_PASSWORD}
echo "Backup path: $SNAPSHOTDIR/$BDIR"
SNAPSHOTPATH=$SNAPSHOTDIR
if [[ -n "$BDIR" && "$BDIR" != "." ]]; then
SNAPSHOTPATH=$SNAPSHOTDIR/$BDIR
fi
echo "Backup path: $SNAPSHOTPATH"
# backup the snapshot (without freezing the filesystem)
# use -q for quiet mode (when run as a cron job)
ionice -c 3 $RESTIC --repo $URI $EXCLUDE $QUIET backup $SNAPSHOTDIR/$BDIR
ionice -c 3 $RESTIC --repo $URI $EXCLUDE $QUIET backup "$SNAPSHOTPATH"
./lock.sh unlock $uuid
@ -102,7 +107,7 @@ if ! ./lock.sh haslock; then
fi
# delete everything older than the last X snapshots
$RESTIC --repo $URI $QUIET forget --keep-last $KEEPLAST --path "$SNAPSHOTDIR/$BDIR"
$RESTIC --repo $URI $QUIET forget --keep-last $KEEPLAST --path "$SNAPSHOTPATH"
unset RESTIC_PASSWORD