Script de restauration virt-backup

This commit is contained in:
Adrien Bourmault 2022-05-21 00:50:39 +02:00 committed by admin666
parent dac2f3fb2d
commit 5384129802
1 changed files with 19 additions and 0 deletions

19
restore.sh Executable file
View File

@ -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"