The sys admin's daily grind: iWatch

In a Minute

Article from Issue 165/2014
Author(s):

Recently, sys admin Charly was faced with the task of synchronizing a directory on a server with two NFS-mounted clients. He wanted the whole thing to happen quickly and to be easily manageable, which ruled out DRBD and GlusterFS.

My sync setup looks roughly like this: An application server cyclically reads values from a database, generates HTML files and some images, and dumps everything in the /source directory. I use NFS 4 to mount the /dest1 and /dest2 directories. When any new data arrives in /source, I want it to reach the two target directories /dest1 and /dest2.

Simple and Been Here for Years

Because complex solutions are out of the question, actually the only option left is to dump the task on inotify subsystem's plate. Inotify has been part of the kernel since 2.6.13 and provides an interface to filesystem events for userspace programs.

Apart from incron [1], I've hardly found a use for it so far, but it should be ideal for quick syncing of directories – or at least, these were my ideas on the matter. What was missing was the right tool for the task. Some quick research brought to light two candidates: lsyncd [2] and iWatch [3], but I'll focus on iWatch here.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • iWatch

    Why wait for cron? iWatch monitors critical files and directories in realtime. This handy Perl script then notifies the user or runs a configurable command when change occurs.

  • Charly's Column

    While cron doggedly keeps to a fixed schedule, Incron monitors directories and runs commands when changes occur.

  • Detecting Intruders Intro

    If you think your systems are too obscure for an attacker to worry about, think again. Today’s intruders are happy for any victim.

  • Charly's Column: Pulse

    Equal treatment, as sys admin Charly so boldly proposes, should be the norm. What he really wants is a free tool to sync user data across multiple computers.

  • Live Sync with lsyncd
comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News