infra-generale/restore.sh

20 lines
356 B
Bash
Raw Normal View History

2022-05-21 00:50:39 +02:00
#!/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"