Using inotify to monitor the filesystem

Slashdot it! Delicious Share on Facebook Tweet! Digg!
watchara rojjanasain, 123RF

watchara rojjanasain, 123RF

Under Control

Keeping an eye on possible changes to the filesystem can prove very beneficial. It can also help you to automate many processes.

It always happens that as soon as you have created or changed a particular file, you want to start compiling, generate an archive, or upload the file to a server. Previously you turned to some sort of so-called "busy waiting" tool. Now the inotify tools accomplish the task much more conveniently and elegantly [1].

A busy waiting tool is a program that runs in an endless loop, repeatedly calling up the same information. An example would be a script that monitors the contents of a directory. The program compares the information with previously collected data and triggers when they are different. However, this process is ineffective. In the worst case scenario, it can also damage the data storage device.

It would be much better if monitoring was automated. The kernel could then use a special interface to notify all of the programs that are waiting for a change to a file. The Amiga filesystem contained this technique. Under Linux, there is a corresponding function by the name of inotify (a name that was created by combining "inode" with "notify"). Linux uses inotify for certain entries in the filesystem.

[...]

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

Buy this article as PDF

Express-Checkout as PDF

Pages: 3

Price $0.99
(incl. VAT)

Buy Ubuntu User

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

US / Canada

Get it on Google Play

UK / Australia

Related content