From 53841298026298746042d7bef45bd00e746844c7 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Sat, 21 May 2022 00:50:39 +0200 Subject: [PATCH] Script de restauration virt-backup --- restore.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 restore.sh diff --git a/restore.sh b/restore.sh new file mode 100755 index 0000000..8ada6cb --- /dev/null +++ b/restore.sh @@ -0,0 +1,19 @@ +#!/bin/bash +vm=$1 +date=$2 +disk=$3 +destpath=$4 + +if [[ $# != 4 ]] +then + echo "ERROR: 4 parameters required (vm, date, disk, destination)" + exit 1 +fi + +backup_file=$(sudo virt-backup list -D ${vm} | grep ${date} | cut -d " " -f 2 | sed "s/.json/_${disk}.raw/g") + +echo "Restoring for $backup_file" +sudo cp --sparse=always -v "$backup_file" "$destpath" + + +