Hi All, I am thinking about an idea, but it requires that I be able to watch several directories for files that are added, deleted or maybe changed. Let start with adding files. What tools are available for me to watch a directory. In an example, if a file is added to a directory I want to run a shell script that will do some conversation on the file to produce a second copy. I have the shell scripting down, I am not sure how to watch, realize change and kick off the script with the parameters of the directory and what was added. Would anyone have thoughts? -Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20110316/9f2918b2/attachment-0001.html>
On Wed, 16 Mar 2011, Jason Slack-Moehrle wrote:> Would anyone have thoughts?don't reinvent the wheel inotify builds and works fine on CentOS 5 -- Russ herrold
on 14:06 Wed 16 Mar, Jason Slack-Moehrle (slackmoehrle.lists at gmail.com) wrote:> Hi All, > > I am thinking about an idea, but it requires that I be able to watch several > directories for files that are added, deleted or maybe changed. > > Let start with adding files. What tools are available for me to watch a > directory. In an example, if a file is added to a directory I want to run a > shell script that will do some conversation on the file to produce a second > copy. > > I have the shell scripting down, I am not sure how to watch, realize change > and kick off the script with the parameters of the directory and what was > added. > > Would anyone have thoughts?make -- Dr. Ed Morbius, Chief Scientist / | Robot Wrangler / Staff Psychologist | When you seek unlimited power Krell Power Systems Unlimited | Go to Krell!
> Let start with adding files. What tools are available for me to watch a directory. > In an example, if a file is added to a directory I want to run a shell script that > will do some conversation on the file to produce a second copy.I just was working on something like this today - yum search inotify - here's a nice intro with an example close to what I'm using: https://github.com/rvoicilas/inotify-tools/wiki/#info (inotifywait example 1) I used -e create -e modify -e delete instead of -e close_wait - see the man page for events. Very slick so far. Josh