diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-03-08 19:35:10 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-03-08 19:35:10 -0300 |
commit | 7b60ac4e7dfecf54953df6d588c5af0864e56ee7 (patch) | |
tree | 13c3648046e838fcf403689821c4d87ceeb305ec /share/hydractl | |
parent | 7faa673c290bf8466ff919252770fc636aa5c4dc (diff) | |
download | hydra-7b60ac4e7dfecf54953df6d588c5af0864e56ee7.tar.gz hydra-7b60ac4e7dfecf54953df6d588c5af0864e56ee7.tar.bz2 |
Check for folder and key at backup-restore-master
Diffstat (limited to 'share/hydractl')
-rwxr-xr-x | share/hydractl/backup-restore-master | 14 |
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" |