Unison Basics

I use unison to keep my files in sync between several computers.

Unison is used to keep certain files in sync between my:

I do this via a "hub" formation. One of the nodes is chosen as the hub, and all the other nodes synchronize with the hub. In my case, I chose the VPS as the hub, since it's the one most likely to be up and running all the time.

I have a little script called "syncvps.sh" which gets run every 10 minutes on each node except the hub:

dcr@zinc:~$ crontab -l
0,10,20,30,40,50 * * * * /home/dcr/sandbox/bin/syncvps.sh

The active ingredient of syncvps.sh is the unison call:

/usr/bin/unison /home/blah ssh://dcr@myvps.net//home/blah -batch -path .emacs -path .bbdb -path pim 2>&1 | tee -a $LOGFILE | grep "<-?->" >> $SYNC_PROBLEM_MSG

As you can see, I sync my .emacs, .bbdb, and all files under the pim directory, including my diary file and GTD files. The batch option means to skip any questions.

Note that I grep for "<-?->" in the output. "<-?->" is a signal that there is a conflict in the synchronization (if, for example, the same file was modified on two nodes within the 10 minute interval between synchronizations). The grep allows me to take action if there is a conflict.

UnisonBasics (last edited 2010-02-01 02:20:57 by DesmondRivet)