application for monitoring directory changes

Lo,

I’m searching for something like crontab. but the action should not be executed at a specific time but after a file or directory change.

I’d like to run some scripts as soon a new file is in a predefined directory.

A daemon / shellscript would be really great. Does anybody know something like that?

Hi
You can do this with SEC- simple event correlator, monitoring a
directory for a file added or time change.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.24-0.2-default
up 2 days 23:20, 2 users, load average: 0.06, 0.10, 0.09
GPU GeForce 8600 GTS Silent - Driver Version: 260.19.21

Thx malcolmlewis,
I thought there might be something in the default suse repository, seems I thought wrong.

Thanks malcolmlewis, that looks like a useful utility. I must remember that.

But I fear it’s insufficient for the OP’s requirement. In particular it is used to monitor a file/pipe/etc that has input data written to it. When a file is added to a directory, that’s not writing data to a stream, it’s modifying a directory.

You could I suppose call ls or something periodically, doing a diff against the last run, and writing the diff to a file, but that defeats the purpose since it requires polling.

There is a Linux system call inotify that can be used to solve the OP’s requirement, it needs a utility written to call it to make it useful. A quick search turned up a Perl module that uses inotify. Perhaps a broader search will find a complete utility.

http://search.cpan.org/~twerner/Linux-Inotify-0.05/lib/Linux/Inotify.pm

@ken_yap
It’s here, in the noarch directories;
Index of /repositories/home:/malcolmlewis:/Miscellanous

I have an open service request with the server/monitoring repository for it to be included there.

I started using it a long time ago with solaris to monitor syslogs from equipment and then sending snmp traps to the network monitory system.

On 2010-11-16 14:06, ken yap wrote:

> You could I suppose call ls or something periodically, doing a diff
> against the last run, and writing the diff to a file, but that defeats
> the purpose since it requires polling.

famd.

famd (8) - The File Alteration Monitor (FAM) daemon
famd.conf (5) - The File Alteration Monitor (FAM) configuration file


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

It looks like famd uses dnotify, which has been deprecated in favour of inotify, which is still supported though.

It seems that gamin is a utility that uses inotify.

inotify - Wikipedia, the free encyclopedia

Hi guys,
Am taking a look at these, too.
Curiously, it looks like a version of famd is already installed in a default 11.3 install, but inaccessible to the User, supposedly installed for the benefit of the KDE or Gnome desktops.

Found both fam-server (which installs a User-accessible version of famd) and gamin in the OpenSuSE repository.

ken_yap, am curious how you determined famd uses dnotify? Am looking, and can’t find a listed dependency, did you look that info up somewhere or run a trace?

Thx,
Tony

It’s in the famd documentation. Actually famd can be configured to use different methods, including polling but dnotify is recommended for Linux.

Another option:
Just noticed that a “File Change Monitor” widget is included in a default KDE4 install. Probably hooks into the fam used by KDE but normally inaccessible to Users as I mentioned before.
Haven’t used it personally.

Tony

Hi
@ken_yap Just a heads up if your looking for sec, it’s been accepted
into the server:monitoring repository :wink:


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.24-0.2-default
up 2 days 19:32, 2 users, load average: 0.12, 0.10, 0.14
GPU GeForce 8600 GTS Silent - Driver Version: 260.19.21

Hi
I know this is an old thread, but just to say I’ve updated SEC - simple event correlator to version 2.6.1 and added systemd support.

It should be available soon from the server:monitoring repository.