aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl
diff options
context:
space:
mode:
Diffstat (limited to 'share/hydractl')
-rwxr-xr-xshare/hydractl/backup-restore-master14
1 files changed, 12 insertions, 2 deletions
diff --git a/share/hydractl/backup-restore-master b/share/hydractl/backup-restore-master
index ecbb64c..bb394c1 100755
--- a/share/hydractl/backup-restore-master
+++ b/share/hydractl/backup-restore-master
@@ -27,7 +27,17 @@ BASENAME="`basename $0`"
HOST="$1"
DOMAIN="`facter domain`"
-# TODO: check if keys and files exist
+# Check for a backup key
+if ! gpg --list-secret-keys root@$BACKUP.$DOMAIN &> /dev/null; then
+ echo "fatal: secret key for root@$BACKUP.$DOMAIN not available"
+ exit 1
+fi
+
+# Check base restore folder
+if [ ! -d "/var/backups/remote/$BACKUP.$DOMAIN/restore/" ]; then
+ echo "fatal: restore folder /var/backups/remote/$BACKUP.$DOMAIN/restore/ not available"
+ exit 1
+fi
hydractl backup-restore $HOST rsync
hydractl backup-restore-git $HOST
@@ -40,4 +50,4 @@ hydractl backup-restore-munin $HOST
# Teardown
echo "Now check the restoration process and cleanup keys and files by running:"
echo "rm -rf /var/backups/remote/$BACKUP.$DOMAIN/restore/"
-echo "gpg --delete-secret-and-public-keys root@$BACKUO.$DOMAIN"
+echo "gpg --delete-secret-and-public-keys root@$BACKUP.$DOMAIN"