Lets sync two local folders
dir2. The two folders are called roots in
Lets create two empty folders
dir2 and sync them. Syncing for the first time is a bit special, since
unison informs us that these two roots have not been synced with
$ unison dir1 dir2 Contacting server... Warning: No archive files were found for these roots, whose canonical names are: /Users/mrepic/Desktop/LCBC_retreat/unison/example/dir1 /Users/mrepic/Desktop/LCBC_retreat/unison/example/dir2 . . . Looking for changes Reconciling changes
Lets create a file
dir2. This kind of copying cannot be performed by
rsync so simply.
Contacting server... Looking for changes Reconciling changes dir1 dir2 new file ----> file1.txt [f] <---- new file file2.txt [f] Proceed with propagating updates?  y Propagating updates UNISON 2.48.3 started propagating changes at 12:06:54.09 on 17 Oct 2015 [BGN] Copying file1.txt from /example/dir1 to /example/dir2 [END] Copying file1.txt [BGN] Copying file2.txt from /example/dir2 to /example/dir1 [END] Copying file2.txt UNISON 2.48.3 finished propagating changes at 12:06:54.10 on 17 Oct 2015 Saving synchronizer state Synchronization complete at 12:06:54 (2 items transferred, 0 skipped, 0 failed)
Download binaries from official website and make sure the version number is the same. Unison will not work if they differ. Put it somewhere in your
PATH, so that it can be invoked locally and remotely. Test if it works by executing
unison -version on the local machine
ssh deneb1.epfl.ch unison -version on the remote machine.
It is a good idea to sync the
~/.unison/*.prf files, so that the profiles will be available on every machine and you will be able to start sync from both sides if two-way passwordless ssh works.
Selective sync The roots do not have to be completely synced. For example, certain paths and files can be excluded from the sync, also files based on size (large trajectories, folder display files,...).
unison can be used in batch mode, syncing the nonconflicting updates without user intervention. Conflicting updates are displayed and user is prompted to select the direction of the sync, or they can be ignored and not synced.
Each root can be continously synced on a fixed time interval. There is also support for sync on change so it behaves very much like
Complex syncing preferences can be saved in a file residing in
~/.unison/dirs.prf. When such a file exists, you can invoke unison with
A sample preference file looks like this:
# Unison preferences file root local = /Users/mrepic/hpc root workstation = ssh://mrepic@l27//data9/mrepic/hpc # Useful settings confirmbigdel = true sortybysize = true logfile = /dev/null # Main sync paths #path = maogmx/adacta2/4.1-equil_bilayer #path = scratch # Override files matching ignore spec ignorenot = Name *.out ignorenot = Name *.off # Ignore Mac files ignore = Name .DS_Store ignore = Name *~ ignore = Name .*~ ignore = Name ._* ignore = Name .localized # Ignore Torque files ignore = Name *.o* ignore = Name *.po* ignore = Name core.* ignore = Name .* # Ignore trajectories ignore = Name *.trr ignore = Name *.xtc ignore = Name *.nc ignore = Name *.dcd ignore = Name TRAJECTORY