Synchronize files between multiple hosts.
[rsync(1)](/man/rsync.1.html)for fast copying between peers
Run these commands to build and install
synk on your system:
$ make # make install
The following requirements are needed in order for
[synk(1)](/man/synk.1.html) to work
between multiple peers:
synkmust be installed, and in the
$PATHon each peer
ssh(without a prompt)
For more information on how this program works, check the synk(1) and synk.conf(5) manpages. As a quick reference, here is an example usage:
# Output "peer: HOSTNAME PATH SHA512 MTIME" $ synk -v $HOME/file -h keel.z3bra.org -h orbb.z3bra.org peer: localhost /home/z3bra/file c8e37eb 1473157623 peer: orbb.z3bra.org /home/z3bra/file 6d4af03 1473157643 peer: keel.z3bra.org /home/z3bra/file 005f686 1473157705 master: keel.z3bra.org synk: rsync -azEq --delete keel.z3bra.org:/home/z3bra/file /home/z3bra/file synk: ssh keel.z3bra.org rsync -azEq --delete /home/z3bra/file phobos.z3bra.org:/home/z3bra/file
Local client spawns server-mode instances to peers via ssh:
synk $FILE \_ ssh phobos.z3bra.org 'synk -s' \_ ssh apophis.z3bra.org 'synk -s' \_ ssh doom.z3bra.org 'synk -s'
Client sends metadata for
$FILE to each peer, which includes the following:
* filename (as passed on the command line) * sha512 digest for this file * last modification fime
Each peer will then recreate this structure locally, using the given path and send it back to the client, which will build a list of peer/metadata internally.
This list is then processed to figure out wether all sha512 digests
together match or not. In case a difference is found, the modification
times are used to determine a "master", which will
rsync it local file
to all other peers (localhost included).
In this case, we have two possibilities:
If localhost is the most recent, we just spawn
locally to update the file with peer that have a different hash:
synk file \_ rsync -azEq file phobos.z3bra.org:file \_ rsync -azEq file apophis.z3bra.org:file \_ rsync -azEq file doom.z3bra.org:file
We need to spawn
[rsync(1)](/man/rsync.1.html) processes remotely on the host, to sync it
with all the peers (except for localhost):
synk file \_ rsync -azEq phobos.z3bra.org:file file \_ ssh phobos.z3bra.org 'rsync -azEq file apophis.z3bra.org:file' \_ ssh phobos.z3bra.org 'rsync -azEq file doom.z3bra.org:file'
ISC License. See LICENSE file for copyright and license details.
git clone git://z3bra.org/
If you find any bug, please report them or send a patch to email@example.com.