mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2024-11-24 17:21:03 +01:00
Optimized performance of backup script
This commit is contained in:
parent
f23ea7e6d3
commit
568888952f
@ -1,6 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# @param $1 Volume-Name
|
# @param $1 Volume-Name
|
||||||
|
# @param $2 Hash-Name
|
||||||
volume_name="$1"
|
volume_name="$1"
|
||||||
backup_path="$2"
|
backup_hash="$2"
|
||||||
|
backup_path="/Backups/$backup_hash/docker-volume-backup/latest/$volume_name"
|
||||||
|
if docker volume inspect; then
|
||||||
|
echo "Volume $volume_name allready exists"
|
||||||
|
else
|
||||||
|
echo "Create volume $volume_name"
|
||||||
docker volume create "$volume_name"
|
docker volume create "$volume_name"
|
||||||
docker run --rm -v "$volume_name:/recover/" -v "$backup_path:/backup/" "kevinveenbirkenbach/alpine-rsync" sh -c "rsync -avv /backup/ /recover/"
|
fi
|
||||||
|
if [ ! -d "$backup_path" ]; then
|
||||||
|
echo "ERROR: $backup_path doesn't exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
docker run --rm -v "$volume_name:/recover/" -v "$backup_path:/backup/" "kevinveenbirkenbach/alpine-rsync" sh -c "rsync -avv --delete /backup/ /recover/"
|
||||||
|
Loading…
Reference in New Issue
Block a user