Disclaimer: I've never tried rsync's server (daemon) mode, don't
know anything about using it. I always use rsync over ssh.

If you have ssh available, I recommend it very highly. It should be
a great match for your needs here.

> 1) I don't have the root privilage for two unix machines and I
>    wanna mirror 2GB of sources between them through very slow
>    internet link.

If you can rsync from one of them to the other, either direction,
then you can do rsync over ssh. If you want it to be purely
automatic, set up an RSA key for the ssh connection, with no
passphrase, and when you install the key in the authorized_keys
file on the receiving end, prepend it with a wrapper command, so the
authorized_keys file looks something sorta like

        command="/path/to/wrapper" 1024 35 146895502357......

Initially make the wrapper script simply

        #!/bin/sh
        echo $SSH_ORIGINAL_COMMAND >/tmp/foo
        exec $SSH_ORIGINAL_COMMAND

Now use it once for the rsync, and then replace the wrapper script
with one that's simply

        #!/bin/sh
        exec rsync --server ...

where the exact command you are execing is taken out of /tmp/foo.
This way that key can only be used for that one command, nothing
else. Once this is all set up you can put the invocation of the
rsync command to do the mirroring into a cron job.

> what are the options I have to
> use for faster transfer.

I often use "-aze ssh" for mirroring. Other options sometimes get
added.

> 2) Assume that the internet link is down inbetween, how can i setup rsync, so
> that it will automatically resume once the link is up. 

        #!/bin/sh

        until rsync ...;do
                sleep 5
        done

i.e. keep retrying as long as rsync keeps exiting with non-zero
status. Since rsync effectively discovers where the last one left
off and resumes naturally, and since ssh is quite good (in my
experience, this varies from platform to platform, version to
version, individual to individual...) at not hanging and at
detecting lost connections and breaking off after a little while,
such a loop ought to get the bits across reliably.

-Bennett

PGP signature

Reply via email to