On Wed, Oct 04, 2000 at 09:43:22AM -0400, Yan Seiner wrote:
> I'm struggling with something that should be simple.
>
> I'm running rsync over a dial-up that is not really reliable, so rsyncs
> fail pretty often.
>
> I'd like to do something like this, assuming that the return code from
> rsync > 0 on failure (not a shell script, just some sloppy pseudocode):
>
> while `rsync ... blah... ` do ;;
>
> Has anyone done this? Is there an example or some pitfalls to
> watch?
That should work fine: each invocation will pull the files closer into
sync, or do nothing if they're already in sync.
> while `rsync ... blah... ` do ;;
However, unlike C, Unix shells interpret zero return (successful
completion) as true, and nonzero as false. Therefore you should
instead do
until rsync OPTS FROM TO; do : ;done
The : is a null operation in sh.
You should use the -t option (or the -a option) to make sure the file
times are set on the destination, so that rsync can just check them
next time.
You may want to use --partial, so that if the transfer is interrupted
then a half-finished file will be left rather than the old version.
--
Martin Pool
PGP signature