diff --git a/backupscript.sh b/backupscript.sh index 82cbf5e..7371223 100755 --- a/backupscript.sh +++ b/backupscript.sh @@ -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