- Web Server
- Control Panels
- Site Map/RSS Feeds
Keeping Your Sanity with Unison
Author: Joe Topjian <joe [at] adminspotting [dot] net>
I hate it when I have two identical scripts on two servers and have to make changes to each one or when I want to copy something to my powerbook and have to manually copy the modified version back to the fileserver when I am done. While other versioning tools like subversion handle this extremely well, they are overkill for my needs. Unison gives me the simplicity to do exactly what I want with no hassle. Hence, it keeps my sanity!
Unison runs on Unix, Windows, and MacOS X. Personally, I use it on Debian and OS X. To install on Debian, just type:
apt-get install unison
On OS X, I use DarwinPorts and install it like so:
sudo port install unison
Like I mentioned above, running Unison is incredibly easy. Lets say you have a directory called "scripts" and you wanted to sync it with another directory called "scripts-backup". You would do this:
unison scripts scripts-backup
Unison will notice the first time you sync something and mention it to you. It will then run though the directory and files and ask you if you want to sync it or not. To accept the sync, just hit enter or else ? for help.
This is all well and fine if you want to sync something on the same computer, but what about remotely? Unison supports socket and SSH transfers -- SSH being the prefered. To sync something remotely, do:
unison scripts ssh://server//path/to/scripts-backup
You'll be promted for SSH authentication and then the rest is the same as if you were to run it locally.
But wait, there's more! Typing all those paths over and over gets tedious.. let's make a few shortcuts. Create a directory called .unison in your home directory. Inside, create a file called "scripts.prf". Inside scripts.prf have:
root = /path/to/scripts
root = ssh://server//path/to/scripts-backup
Now all you need to do is type:
And Unison will do the rest for you.
That's really all you need to get started with the basics. The preference file can get a lot more detailed and all of those details are described in the Unison Manual.
Original location of this document: http://adminspotting.net/howtos/unison.html