broken pipe when using rsync via ssh

Just some interesting code to remember

The Issue

When copying large image files between servers I use rsync to resume/continue interrupted file transfers.

The file transfer can be secured by ssh/sftp, but might result in broken pipe errors when the connection is dropped while checksums are calculated.

My Solution

This command copies files via ssh by rsync:

rsync -av --progress --append-verify -e "ssh -p 22" root@source-server.mydomain.com:/path/to/files/ .

To resolve broken pipe errors:

cat <<EOF >> ~/.ssh/config
Host *
  ServerAliveInterval 120
  ServerAliveCountMax 100
EOF
comments powered by Disqus