Wednesday, September 13, 2006

File synchronization

I've been searching for a linux based utility that will allow me to synchronise my files. It needs to be able to act as a backup utility and also as a sync utility for my laptop.

I finally found Unison which is only an "apt-get install" step away from Ubuntu users. If you are using unison, the config files are kept in ~/.unison

Running unison is pretty simple and like all good software, it works simply out of the box but provides plenty of advanced features for those who are interested and read the documentation!

Unison notices when you do your first sync and mentions it to you. It then runs through the directory contents and checks that you want to sync it. If you have a directory called scripts and want to sync it with a backup directory called backup, the two examples below show how you would sync local and remote directories.
unison scripts backup
unison scripts ssh://server//path/to/scripts
You'll be prompted for authentication and then all is the same as before. It has to be said that constantly typing paths does get tedious and you can therefore create a config file and place it within the .unison directory. For this example, create a file called scripts.prf:
# You must have exactly 2 root declarations
root = scripts
root = ssh://server//path/to/scripts

# If you wish to ignore files
ignore = Name .*
# ignores all files starting with . - ie. hidden files and directories
To execute the newly saved script, run:
unison scripts
There are many other repositries of information related to unison, such as in-depth discussion and the user manual

No comments: