[lug] How to monitor directory changes from a shell?
Kevin Fenzi
kevin at scrye.com
Thu Feb 22 23:00:13 MST 2007
On Thu, 22 Feb 2007 19:45:27 -0700
pjr at ucar.edu (Phil Rasch) wrote:
> I need to employ a simple mechanism from within a shell script that
> will notify the script when a directory changes status. Ideally the
> script would call a utility that will "pause" until the directory has
> something written to it. When the directory changes, the utility would
> react by quitting, and return control to the script.
Take a look at 'inotify'
http://en.wikipedia.org/wiki/Inotify
Basically this allows you to have the kernel notify you when something
happens to a file or directory.
I haven't used the inotify-tools that are referenced on the above link,
but I have played around with 'incron':
http://inotify.aiken.cz/?section=incron&page=about&lang=en
which is very super cool.
Basically it's a cron like setup, where you tell it: if this file or
directory operation happens on this file or directory, run this
command.
incron is available now in fedora. Not sure about other distros.
kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20070222/f617552d/attachment.pgp>
More information about the LUG
mailing list