From 3f6f1b218a844a434e2c9d11c4e6baf04e1d83f8 Mon Sep 17 00:00:00 2001 From: David Rotermund Date: Tue, 16 Jul 2024 18:05:06 +0200 Subject: [PATCH] Update make_backup.sh --- backup/make_backup.sh | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/backup/make_backup.sh b/backup/make_backup.sh index f051755..1d3344e 100644 --- a/backup/make_backup.sh +++ b/backup/make_backup.sh @@ -1,26 +1,6 @@ #!/bin/bash rsync -avz --delete -e "ssh -i /root/backup/backup" /root paserver@backup.zfn.uni-bremen.de:/home/paserver/backup_root/root - -# Set variables -REMOTE_USER="paserver" -REMOTE_HOST="backup.zfn.uni-bremen.de" -REMOTE_DIR="/home/paserver/backup_docker" -SSH_KEY="/root/backup/backup" - -# Get list of all Docker volumes -volumes=$(docker volume ls --format "{{.Name}}") - -# Backup each volume -for volume in $volumes -do - echo "Backing up volume: $volume" - - # Create a new container from busybox image, mount the volume and tar it up, - # then pipe it directly to the remote server via SSH - docker run --rm -v $volume:/volume busybox tar cf - /volume | \ - ssh -i $SSH_KEY $REMOTE_USER@$REMOTE_HOST "cat > $REMOTE_DIR/$volume.tar" - - echo "Finished backing up $volume" -done +docker exec -it backup /bin/sh -c 'cd /data/ ; rsync -avz --delete -e "ssh -o StrictHostKeyChecking=accept-new -i /data/backup" /data/backup_docker paserver@backup.zfn.uni-bremen.de:/home/paserver/backup_docker/' echo "Backup completed" +