URI:
       tREADME - synk - synchronize files between hosts
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tREADME (2813B)
       ---
            1 synk
            2 ====
            3 
            4 Synchronize files between multiple hosts.
            5 
            6 * one-shot tool (no running daemon)
            7 * Compares sha512 to check synchronisation status
            8 * Last modification time used to elect a "master"
            9 * uses `rsync(1)` for fast copying between peers
           10 
           11 Installation
           12 ------------
           13 Run these commands to build and install `synk` on your system:
           14 
           15         $ make
           16         # make install
           17 
           18 Usage
           19 -----
           20 The following requirements are needed in order for `synk(1)` to work
           21 between multiple peers:
           22 
           23 * `synk` must be installed, and in the `$PATH` on each peer
           24 * peers must be able to interconnect via `ssh` (without a prompt)
           25 
           26 For more information on how this program works, check the synk(1) and
           27 synk.conf(5) manpages. As a quick reference, here is an example usage:
           28 
           29         # Output "peer: HOSTNAME PATH SHA512 MTIME"
           30         $ synk -v $HOME/file -h keel.z3bra.org -h orbb.z3bra.org
           31         peer: localhost /home/z3bra/file        c8e37eb 1473157623
           32         peer: orbb.z3bra.org    /home/z3bra/file        6d4af03 1473157643
           33         peer: keel.z3bra.org    /home/z3bra/file        005f686 1473157705
           34         master: keel.z3bra.org
           35         synk: rsync -azEq --delete keel.z3bra.org:/home/z3bra/file /home/z3bra/file
           36         synk: ssh keel.z3bra.org rsync -azEq --delete /home/z3bra/file phobos.z3bra.org:/home/z3bra/file
           37 
           38 Internal logic
           39 --------------
           40 
           41 Local client spawns server-mode instances to peers via ssh:
           42 
           43         synk $FILE
           44          \_ ssh phobos.z3bra.org 'synk -s'
           45          \_ ssh apophis.z3bra.org 'synk -s'
           46          \_ ssh doom.z3bra.org 'synk -s'
           47 
           48 Client sends metadata for `$FILE` to each peer, which includes the following:
           49 
           50         * filename (as passed on the command line)
           51         * sha512 digest for this file
           52         * last modification fime
           53 
           54 Each peer will then recreate this structure locally, using the given path
           55 and send it back to the client, which will build a list of peer/metadata
           56 internally.
           57 
           58 This list is then processed to figure out wether all sha512 digests
           59 together match or not. In case a difference is found, the modification
           60 times are used to determine a "master", which will `rsync` it local file
           61 to all other peers (localhost included).
           62 
           63 In this case, we have two possibilities:
           64 
           65 ### localhost is the most recent
           66 
           67 If localhost is the most recent, we just spawn `rsync(1)` processes
           68 locally to update the file with peer that have a different hash:
           69 
           70         synk file
           71          \_ rsync -azEq file phobos.z3bra.org:file
           72          \_ rsync -azEq file apophis.z3bra.org:file
           73          \_ rsync -azEq file doom.z3bra.org:file
           74 
           75 ### remote peer X is the most recent
           76 
           77 We need to spawn `rsync(1)` processes remotely on the host, to sync it
           78 with all the peers (except for localhost):
           79 
           80         synk file
           81          \_ rsync -azEq phobos.z3bra.org:file file
           82          \_ ssh phobos.z3bra.org 'rsync -azEq file apophis.z3bra.org:file'
           83          \_ ssh phobos.z3bra.org 'rsync -azEq file doom.z3bra.org:file'
           84 
           85 License
           86 -------
           87 ISC License. See LICENSE file for copyright and license details.
           88