Rsync over SSH - timeout in ssh or rsync?

user1753780 picture user1753780 · Oct 17, 2012 · Viewed 23.8k times · Source

I'm dealing with a crappy ISP that resets my WAN connection at random points while my script is running. I want the transfer to survive this reset and go on. I manually launch this script vs using cron / launchd currently.

I have a fairly basic script as shown below:

rsync -rltv --progress --partial -e "ssh -i <key> -o ConnectTimeout=300" <remotedir> <localdir>

Am I better off putting the timeout in the rsync section instead?

For example:

rsync -rltv --progress--partial --timeout=300 -e "ssh -i <key>" <remotedir> <localdir>

Thanks!

Answer

Barmar picture Barmar · Oct 17, 2012

ConnectTimeout only applies when SSH is trying to establish the connection with the server, it doesn't have anything to do with timeouts during the data transfer. So you need to use the --timeout option to do what you want.