29 lines
752 B
Bash
Executable File
29 lines
752 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Restores data from backblaze for a particular VM id
|
|
|
|
. /etc/federated
|
|
. /federated/lib/functions.sh
|
|
|
|
usage() {
|
|
cat << EOF
|
|
Restore from Backblaze a specific VM id
|
|
Usage: $0 passkey service vmid
|
|
Arguments:
|
|
passkey - the GPG passkey for the VMID
|
|
service - service to restore: listmonk,nextcloud,etc
|
|
vmid - the VM id: f12345a1
|
|
|
|
EOF
|
|
exit 2;
|
|
}
|
|
|
|
[ $# -ne 3 ] && usage
|
|
PASSKEY=$1
|
|
SERVICE=$2
|
|
VMID=$3
|
|
|
|
echo "* Restoring $SERVICE to /federated.restore.$VMID/apps/$SERVICE.."
|
|
PASSPHRASE=$PASSKEY duplicity --force b2://$B2_APPLICATION_KEY_ID:$B2_APPLICATION_KEY@fed-customers/$VMID/federated/apps/$SERVICE/ /federated.restore.$VMID/apps/$SERVICE
|
|
[ $? -ne 0 ] && failcheck "* Couldn't restore files"
|