Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: HOWTO: make your machine react to changes in a directory

  1. #11
    Join Date
    Mar 2006
    Beans
    251

    Re: HOWTO: make your machine react to changes in a directory

    Excellent, I just tried, working great. Thank you.


    Quote Originally Posted by unutbu View Post
    Green_Star, you are quite right dirmon version 0.0 did not react to deleted files.
    I've modified dirmon to now handle such events. You can download dirmon.py (version 0.1)
    from post #1.

    In your .dirmon configuration file, change
    Code:
    event: file_modified
    to
    Code:
    event: dir_changed
    That's it! dirmon should now react whenever a file is created, modified, deleted, or moved to or from the monitored directory.

  2. #12
    Join Date
    Feb 2007
    Location
    Nowhere important
    Beans
    1,198
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: make your machine react to changes in a directory

    I did not read it (yet!), but it looks good, thanks!
    ➙ Synchronize all your files across Windows, Linux and Mac OS with Dropbox (2GB free storage!). By signing up via this link I'll get some extra space also, thanks!

    Multiseat on Ubuntu 10.04

  3. #13
    Join Date
    Apr 2008
    Beans
    426
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: make your machine react to changes in a directory

    Nice. Bookmarked for later use.

    10 respect points awarded.

  4. #14
    Join Date
    Dec 2005
    Beans
    2

    Re: HOWTO: make your machine react to changes in a directory

    This is a very simple and elegant interface to inotify, but I do have a question:

    How do I get the actual Inotify event (ie - IN_CREATE, IN_MODIFY, etc) to be passed on the command line?

    I dont know Python and I have been trying to wing it, but I cant seem to capture the actual event or pass it as Argument 3 to my script.....

    example cmd: dirmon.sh [dirmon.py] [EventPath] [INOTIFY EVENT]

    Since I am using dir_change as the mask, I am catching the events, but I cannot seem to get which event is matched passed to my script......

    Can someone mod dirmon.py so I get the event IN_CREATE, etc... passed as an argument in the cmd ? If I see an example I can do it, but it is probably simple to do - for someone with more experience with python....

    TIA

    WPH

  5. #15
    Join Date
    Nov 2005
    Location
    Republic of Texas, USA
    Beans
    129
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO: make your machine react to changes in a directory

    Can someone point me in the right direction? I am trying to use this to backup my home directory to an external USB drive. When I run it, I get the following error:

    Traceback (most recent call last):
    File "./dirmon.py", line 5, in <module>
    from pyinotify import (WatchManager, Notifier, ProcessEvent,
    ImportError: cannot import name ALL_EVENTS

    Thanks,
    Tim

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

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