Skip to content

Commit

Permalink
feat: remove used backup files after restoring
Browse files Browse the repository at this point in the history
  • Loading branch information
geoje committed Dec 3, 2024
1 parent 4b45d85 commit 43f3fb1
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions server/docker-compose-bu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,20 @@ services:
xtrabackup --decompress --target-dir=$${FULL_DIR}
if [ $${FULL_DIR} = $${LAST_DIR} ]; then
xtrabackup --prepare --target-dir=$${FULL_DIR}
rm -rf /var/lib/mysql/*
xtrabackup --copy-back --target-dir=$${FULL_DIR}
exit 0
fi
xtrabackup --prepare --apply-log-only --target-dir=$${FULL_DIR}
else
xtrabackup --prepare --target-dir=$${FULL_DIR} --apply-log-only
for DIR in `ls -d /backup/*/ | tail -n +2 | head -n -1`; do
xtrabackup --decompress --target-dir=$${DIR}
xtrabackup --prepare --apply-log-only --target-dir=$${FULL_DIR} \
--incremental-dir=$${DIR}
done
for DIR in `ls -d /backup/*/ | tail -n +2 | head -n -1`; do
xtrabackup --decompress --target-dir=$${DIR}
xtrabackup --prepare --target-dir=$${FULL_DIR} \
--incremental-dir=$${DIR} --apply-log-only
done
xtrabackup --decompress --target-dir=$${LAST_DIR}
xtrabackup --prepare --target-dir=$${FULL_DIR} \
--incremental-dir=$${LAST_DIR}
fi
xtrabackup --decompress --target-dir=$${LAST_DIR}
xtrabackup --prepare --target-dir=$${FULL_DIR} \
--incremental-dir=$${LAST_DIR}
rm -rf /var/lib/mysql/*
xtrabackup --copy-back --target-dir=$${FULL_DIR}
rm -rf /backup/*

0 comments on commit 43f3fb1

Please sign in to comment.