05 Jun 2019

Bash Script to Automatically Restart and Resume Failed rsync Transfers

Bash Script to Automatically Restart and Resume Failed rsync Transfers

#!/bin/bash
# automatically restart and resume rsync transfer on failure
 
while [ 1 ]
do
    rsync --progress --partial-dir=.rsync-partial rsync://site.onion/dir/Inventory1.rar ./
    if [ "$?" = "0" ] ; then
        echo "rsync completed normally"
        exit
    else
        echo "rsync failure. Retrying soon..."
        sleep 30
    fi
done