[lug] How to monitor directory changes from a shell?

Phil Rasch pjr at ucar.edu
Fri Feb 23 07:13:02 MST 2007


Inotify works perfectly. Thanks!

I employed the tools that sit on top 
http://inotify-tools.sourceforge.net/
a they work as advertised.

Phil


On Thu, Feb 22, 2007 at 11:00:13PM -0700, Kevin Fenzi wrote:
> 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



> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug



More information about the LUG mailing list