Table of Contents

unison

running unison after you already copied files

:!: Notice the // double slashes on both sides of the ssh hostname

By the time you copy files and start to run a unison command you realize that it doesn't know about anything you did yet. It will bother you with questions about the props (properties) of each and every file, unless you run this once (WARNING - make sure you have both directories in sync first because you will be forcing one):

unison /local/path ssh://hostname//remote/path -force /local/path -batch

The force switch tells unison which version you want to use, and the batch switch means to ask no questions.

typical example (after initial sync)

:!: Notice the // double slashes on both sides of the ssh hostname

sync.sh

#!/bin/bash
 
unison /local/path ssh://hostname//remote/path

command not found errors using ssh

When using ssh with unison, you are creating a non-interactive shell. If unison is installed to /usr/local/bin/unison, you may not have that in your path when using a non-interactive shell. I've tried various solutions to fix this, but the easiest one for me was to symlink to /usr/bin/unison:

# the error...
bash: unison: command not found
Fatal error: Lost connection with the server

# the fix (on the host you are connecting to)...
ln -s /usr/local/bin/unison /usr/bin/unison