executing a command again once it stops (rsync, FreeBSD)

I started doing backups via rsync to a remote server. This works all fine and good but 40 gig take their time and as I get a dynamic IP it gets interrupted every day. So every morning when I wake up I restart rsync (if I don't forget it).

I could use already a cronjob but I would really like to execute it immediately after it stops. Is there a way to do that?


#!/bin/bash
while true
do
    echo "your action (e.g., rsync replacing this line)"

    #If clean exit, stop running
    if [[ $? == 0 ]]
    then
        break
    fi

    #speed throttling
    sleep 10
done

Yes, whenever the rsync or any command stops or is interrupted in wrong way, it gives a signal, which is Not equal to 0(0 means success, otherwise error).

so just write a script , which checks for command exit status and saves it in a file. then keep checking that file after , say 5 seconds. so as far as the exist status becomes non-zero, restart the rsync and put 0 in exit status manually.. keep going on and on.