Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Computing
Conference & Expo
November 2-4, 2009 NYC
Register Today and SAVE !..

2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
In many cases, the end of the year gives you time to step back and take stock of the last 12 months. This is when many of us take a hard look at what worked and what did not, complete performance reviews, and formulate plans for the coming year. For me, it is all of those things plus a time when I u...
SYS-CON.TV
How to sing in unison
Not a voice lesson, we show how to use a tool similar to rsync, only smarter

Thanks to all who responded to last week's column, rsync and the unsung command line. Once again, I am indebted to my readers for bundles of great tips, advice, and corrections. In particular, I'd like to thank those readers who turned me on to a cool utility called unison. I've now replaced rsync with unison for some of my scheduled tasks, since it does a two-way synchronization by default and does it well.

If you want to do a two-way synchronization with rsync, you'll need to run it twice. It isn't difficult to run rsync twice, and doing it that way allows you to automate different synchronization options for one direction than for the other, which can sometimes come in handy. Nevertheless unison is so much easier for straightforward synchronization tasks that I've switched from rsync to unison when it comes to synchronizing my home directory across machines.

Here's the scoop on how to use unison. It is most powerful when you use it interactively, because this gives you a chance to decide how to resolve conflicts when both the source and destination files have changed. However, you don't have to use it interactively for it to be useful. In my case, I have a personal version of the following shell script in my /etc/cron.daily directory on each of my servers. This script synchronizes the home directory from client to the servers.

First, I had to set up my client to run unison as a server. I simply added the following line to one of my boot scripts:

unison -socket 755 &

Note that I'm using port 755 in this example. This is an entirely arbitrary choice. The unison program has no default port. You simply have to avoid using a port that some other network service has taken on your system. I recommend that you choose a privileged port below 1024 because these ports are more likely to be blocked at your firewall. If not, make sure that you block the port you choose, or wrap unison in some other transport such as ssh. Otherwise you'll be opening a huge security hole, because unison is not a very safe utility when left to its own devices.

I avoided the whole issue of port blocking by running the unison server at my client instead of on my servers. My client accesses the Internet using Network Address Translation (NAT), which means the client is inaccessible from the Internet unless I specifically enable port forwarding for any given service.

Here's the script I put in the /etc/cron.daily directory on the server machines.

#!/bin/bash
PATH=/usr/bin:/usr/sbin:/bin:/sbin
echo Synchronizing home
unison socket://myserver:755//home/me /home/me -owner -group -batch \
-prefer socket://myserver:755//home/me

The synchronization will take quite a while the first time you run it, because unison needs to create initial archive files on the source and destination machines, which it will later use to make subsequent synchronization sessions faster. It also creates lock files to help manage transfers.

This actually posed a problem at one point. I have no idea how it happened, but the archive files were somehow corrupted. The corruption of the archive wasn't a big deal - it was the fact that unison didn't want to resolve the problem without my intervention. It's possible I was simply missing a command-line switch somewhere that would automate the resolution to this problem, but given what I knew, all I could do was find out where unison put the archive files and delete them manually, along with the leftover lock files. This could get to be annoying if it happens frequently, because the whole point of using unison in my case is to have it synchronize the directories automatically every night.

We don't need Exchange? So, what's new?

Several other readers corrected my presumption that you need Microsoft Exchange server in order to use the Windows Offline Folders feature that lets you synchronize files in Windows the way rsync or unison synchronizes files on UNIX. I'm not surprised that I got this one wrong, since I don't use Windows for anything but Windows-only games. In case you're wondering where I got the idea that you needed Exchange, it was from Microsoft. I simply searched for the term "Offline Folders" at the Microsoft site and followed the first few links that turned up. You can perform the same search yourself, or check the resources section for a couple of the links I found, but here's the relevant portion of the text from two of the top hits:

"Working with Offline Folders: Offline folders are a feature of Microsoft Exchange Server that makes public folders and mailbox messages available to users when they work offline."

"OL97: What Are Offline Folders and How Do You Use Them? (Q161725) When you use Microsoft Outlook 97 with the Microsoft Exchange Server Information Service, you have the ability to work with folders "offline." That is, you can use the contents of a folder without a network connection, which is beneficial for remote users. This article discusses how you can create, use, and synchronize offline folders."

I'm inclined to believe my readers when they say Microsoft Exchange is now superfluous (as if we Linux fans needed convincing), and no doubt there is a web page somewhere on the Microsoft site that says so. It's a shame Microsoft fails to mention that little detail in the pages that rise to the top of the hit list when you search for the term "Offline Folders".

Duplication of effort

Still other readers pointed out that I was mistaken about having to be present to type in a password if you use Secure Shell (ssh) as your transport when you use rsync to synchronize files. They offered two different methods to get around this requirement - host key authentication and a script automation program called expect. I haven't tried either of these methods, but I can already say that I would prefer the former. It is better to authenticate against a public key than to embed a password into a script. Unless I'm misunderstanding the process, that's what you'd end up with if you use expect.

For those of you who also want to explore the host authentication route, I suggest you follow the link in the resources section to an IBM Developerworks article by Daniel Robbins. The article wasn't terribly useful to me but perhaps it will be for you. If you feel as confused as I am after reading it, drop me a note and I'll try this technique myself in order to write about it in a future column.

Still others mentioned that you could use the InterMezzo filesystem that is now available in the latest 2.4 and 2.5 kernels to perform automatic synchronization. As of this writing, I don't think anyone has mentioned the Coda filesystem, which has been available in the Linux kernel for ages and is similar to InterMezzo in concept. Both are intended for users who need to access files normally located on the network, even when they are disconnected from that network. Both implemented as filesystems. However, I have a feeling that's where the similarity ends. InterMezzo seems much easier to set up and use.

Working on network files while disconnected isn't something I do often, so I'm not compelled to try InterMezzo or the latest version of Coda to see if I'm right. Fortunately, Moshe Bar was clear about his experiences with InterMezzo in a Byte.com article (see resources for link), so if you're interested in this type of synchronization technique, check out his write-up.

Finally, none of the e-mails I've read so far mentioned CVS. CVS is overkill for typical file synchronization needs. It is entirely possible that those of you who know and love CVS will actually use it this way. If either one of you happens to read this column, let me know.

About Nicholas Petreley
Nicholas Petreley is a computer consultant and author in Asheville, NC.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

SOA World Latest Stories
In a surprise move Tuesday Oracle wheeled out its Big Data Appliance. That’s the one it said in October would be ready sometime in the first half. Only nobody believed it meant early in the first half. Heck, it’s not even clear anybody thought Oracle could make the first half at al...
A Munich court Thursday found Motorola Mobility guilty of infringing an Apple patent and handed Apple a permanent injunction against two Android smartphones. Apple can enforce the injunction after posting a bond lest MMI succeed in invalidating the slide-to-unlock patent (EP1964022) ...
Quick Response (QR) codes are intended to help direct users quickly and easily to information about products and services, but they are also starting to be used for social engineering exploits. This article looks at the emergence of QR scan scams and the rising concern for users today....
The Chinese company that claims it owns the iPad trademark says it plans to seek a ban on iPad exports out of China, threatening global supplies. According to what a lawyer for Proview Technology (Shenzhen) Co Ltd told Reuters, the firm is petitioning Chinese customs to stop shipment...
Cisco Wednesday filed suit in the European Union’s second-highest court, the General Court in Luxembourg, challenging the European Commission’s rubber stamp last October of Microsoft’s $8.5 billion acquisition of Skype. Cisco says it isn’t opposed to the merger, but figures the EC sh...
2011 was a year of rapid adoption for public and private cloud services. Instant and on-demand server provisioning was the driving force behind the massive growth. On top, cloud server templates and script automation simplified application installation for simple and pre-defined applic...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE