Sync Early, Sync Often: Unison, Plink and SSH

I like adjusting software to fit what ever it is I’m trying to achieve precisely , I can handle a few popular programming languages quite well and other enough to tweak, kludge and patch as necessary.

when I installed unison, my file syncro of choice,  and tried to sync my old windows XP with my (almost) brand new MacBook Pro I wasn’t thrilled to see this error message displayed on my dos prompt

the path X: is a root directory

See the reason being that Unison having been open and all  is written in Caml,  Maybe I’m a snob  but I don’t anticipate needing these OCaml coding skills anytime soon. looking around at what has been written in Caml:

Zenon is an automatic theorem prover written in OCaml.

…I guess I’ll write my own Theorem Prover in Python should the need arise.

Anyway I could google all the way to the source code but still did not help me much with figuring out how to solve this.

The mission at hand: I’m trying to sync an entire drive  from a XP machine to a OSX machine, I have been able to sync the very same directory with my now defunct Gentoo Machine.

This brings me to another issue I have with unison: it forces you to run the same version on both machines you sync. this is pretty annoying: I had a perfectly working setup on the XP machine but since I had to Install Unison on my OSX and wanted to use MacPorts which in it’s turn installed some later version of unison, sure I could have mocked around with Macports and force a specific version, but forgot that Unison is so finicky and lack decent backward compatibility.

While generally i tend to subscribe to the idea of fixing the world one bug at a time,  I had to skip the opportunity this time around and work my way around what looks like a a new bug in Unison, since the problem seems to be with specifying a root directory of a drive in windows as the sync source I had to work around it by specifying all the sub directories instead of the root directory. In turn I had to bite the bullet and do some dos scripting (something I have not done since the late 80’s).
here is what my script iterating the top level directory of drive x and sending each to unison for synchronization:

for /d %%A in (X:\*) do Unison-Text.exe %%A ssh://osx//users/mousecradle/xp/%%~nxA -sshcmd plink-me.bat

plink-me.bat looks like this ( I think I’ve taken in from here):

@plink osx -i "osx.ppk" -l mousecradle -ssh unison -server unison -server -contactquietly

Contrary to impression that my rants here might create I think that unison is a tremendously useful piece of software and have been a relatively happy user for many years.
Hey it’s an open source, multi-platform, Unix flavored, ssh aware, text mode friendly file synchronization tool, I had to learn lisp for emacs (or rather emacs-lisp if I’d like to be precise) no way I’m learning O-Caml.

This entry was posted in Command Line, open source, productivity tools, Technology and tagged , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s