Redundant Rsync?

Terry Dooher tdooher.lists at naturalmotion.com
Wed Aug 18 15:52:14 GMT 2004


I use the following bit of shell to check whether an rsync server is up:

#!/bin/bash

# Prod the rsync server...
check=$(echo -e "\n" |netcat server1.example.com 873);

if [ "$check" != "@RSYNCD: 26" ]; then {
     echo "Unable to connect to rsync server."
     # Perform your failsafe measures here
} fi

If you're not running rsyncd and connect via SSH, then:
check=$(echo -e "\n" |netcat server1.example.com 22 |head -1);

with $check needing to be whatever your SSH server should return. (Mine 
is "SSH-2.0-OpenSSH_3.8p1 Debian 1:3.8p1-2")

You can wrap that up in a for loop to iterate through a whole bunch of 
servers until you find one that's up if you need to.

Terry.

Ernie Oporto wrote:
> Is there a way to tell rsync that if it does not have contact with a
> certain rsync server to continue on to another for file requests?  I
> imagine something like this, where you define two servers as the
> source...
> 
> /usr/local/bin/rsync {serv1,serv2}::src dest
> 
> ...proposing that 
> 1. Should serv1 be down when the sync is originally started, that
> serv2 be contacted after a timeout.
> 2. Not so important, but probably a desirable thing once the above is
> available, if serv1 or its connection dies in the middle of a sync,
> that the sync continue on to serv2.
> 
> I'm not sure that I'm asking for something as complex as a failover
> mode between paired servers, but just something in the client that
> lets it know to move on.
> 
> 



More information about the rsync mailing list