Synchronize files between multiple hosts.


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:

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 -h
peer: localhost /home/z3bra/file        c8e37eb 1473157623
peer:    /home/z3bra/file        6d4af03 1473157643
peer:    /home/z3bra/file        005f686 1473157705
synk: rsync -azEq --delete /home/z3bra/file
synk: ssh rsync -azEq --delete /home/z3bra/file

Internal logic

Local client spawns server-mode instances to peers via ssh:

synk $FILE
 \_ ssh 'synk -s'
 \_ ssh 'synk -s'
 \_ ssh '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:

localhost is the most recent

If localhost is the most recent, we just spawn [rsync(1)](/man/rsync.1.html) processes locally to update the file with peer that have a different hash:

synk file
 \_ rsync -azEq file
 \_ rsync -azEq file
 \_ rsync -azEq file

remote peer X is the most recent

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 file
 \_ ssh 'rsync -azEq file'
 \_ ssh 'rsync -azEq file'


ISC License. See LICENSE file for copyright and license details.


git clone git://

If you find any bug, please report them or send a patch to