Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] bash - identify changes within a directory.


On Sun, 2008-03-09 at 19:45 +0100, Massimiliano Fantuzzi wrote:
> Hi Guys !
> I really agree with all those methods, they are scriptable and efficient,
> but the best choice at present day is another...
> Is the choice for userland utilities (inotify-tools) to the new kernel
> module inotify.
> 
> It gives granular auditing for files, directories and sockets in general,
> and doesn't introduce prestational overhead, as script may do. sure, you
> have to run a 2.6 kernel, i admit ... 


thanks for that.. this is what i finished up with and it works
beautifully running in background:

#!/bin/bash
while inotifywait -e close foo/bah ; do
        mail -s "testing inotifywait" me@host < "." > /dev/null
done

inotify-tools isn't in the Feisty repository, which was surprising, but
it's easy to build so no problem there.









> > On Sun, 2008-03-09 at 18:40 +1100, david wrote:
> > > #!/bin/bash
> > > if [ -N /some/directory/ ] ; then
> > >         echo "change"
> > > else
> > >         echo "no change"
> > > fi
> > >
> > > The object is to identify changes within a directory. This tells me if
> > > there are any new or deleted files, but not if files within the
> > > directory are modified.
> > >
> > > Is there a trivial way to do it?
> >