Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: application for monitoring directory changes

  1. #1

    Default 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?

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,308
    Blog Entries
    15

    Default Re: application for monitoring directory changes

    Quote Originally Posted by alibab
    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.
    http://simple-evcorr.sourceforge.net/

    --
    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


  3. #3

    Default Re: application for monitoring directory changes

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

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: application for monitoring directory changes

    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/Linu...nux/Inotify.pm

  5. #5
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,308
    Blog Entries
    15

    Default Re: application for monitoring directory changes

    @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.
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  6. #6
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: application for monitoring directory changes

    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)

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: application for monitoring directory changes

    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

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,821
    Blog Entries
    1

    Default Re: application for monitoring directory changes

    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

  9. #9
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: application for monitoring directory changes

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

  10. #10
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,821
    Blog Entries
    1

    Default Re: application for monitoring directory changes

    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

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •