#!/bin/bash

# I assume that connection uses ssh keys WITHOUT passphrase
# To get rid of passphrase from existing key:
# openssl rsa -in private_key_with_pass_phrase -out private_key_without_pass_phrase
# and remeber change permision to be readable only for user

while [ 1 ]
do
    rsync -vrhe ssh --progress --append-verify  <SOURCE> <DESTINATION>
    if [ "$?" = "0" ] ; then
        echo "rsync completed normally"
        exit
    else
        echo "rsync failure. Retrying in a minute..."
        sleep 30
    fi
done
