[GLLUG] syncing files

T Menezes tm.onthemove at gmail.com
Tue Nov 25 10:02:12 UTC 2014


Hi All,

I am in the middle of writing a script (in bash) to sync CVS vaults between
two hosts. Ignoring it's a CVS vault, I am talking about running a cron job
syncing files between two hosts - something that some/most of you probably
do for a living.

I am stuck with this fundamental question about who controls the sync
operation and I was wondering if anyone could enlighten me.

This is a one way sync operation, with the master CVS vault being pushed to
another host. This seems to be a typical application for rsync so that is
what I am going with.

The files to be synced are read from a file in the master host. The files
themselves are also in the master host.

The question is, do I run a push operation from the master host, or a pull
from the mirrored host?

When I use a push operation, I am concerned about leaving the mirrored CVS
vault in an inconsistent state if there is a problem with the comms.

The issue might be easily solved by running a pull operation from the
mirrored host. However, I would have to hard-code the master paths in the
script running from the mirrored host which I would like to avoid if at all
possible (I have full control of the master host; I won't have full control
of the mirrored host). Over and above that, I am not sure how I would read
the file with the list of files to sync from the master/remote host. I
don't think I can use '--files-from' with a path on the remote (master)
host.

So, what would you say is best practice for this case?

1. Push from the master host, perhaps using temporary files on the mirrored
host to flag the start and successful completion of the sync operation?

2. Pull from the mirrored host (with the caveats as per above)

3. None of the above. The solution is...

Thanks in advance
TM

PS. Possible rsync commands:

Push:
rsync -varz --delete \
    --timeout=30 \
    --files-from=/path/local/list_to_sync.txt \
    /path/local/dir \
    remoteuser at remotehost:/path/remote/dir

Pull (I could I make this work?)
rsync -varz --delete \
    --timeout=30 \
    --files-from=remoteuser at remotehost:/path/remote/list_to_sync.txt \
    remoteuser at remotehost:/path/remote/dir \
    /path/local/dir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20141125/a22d20f0/attachment.html>


More information about the GLLUG mailing list