Watch files and translate the changes into salt events

  • pyinotify Python module >= 0.9.5


Using generic mask options like open, access, ignored, and closed_nowrite with reactors can easily cause the reactor to loop on itself. To mitigate this behavior, consider setting the disable_during_state_run flag to True in the beacon configuration.


The inotify beacon only works on OSes that have inotify kernel support.


Watch the configured files

Example Config

    - files:
            - open
            - create
            - close_write
          recurse: True
          auto_add: True
            - /path/to/file/or/dir/exclude1
            - /path/to/file/or/dir/exclude2
            - /path/to/file/or/dir/regex[a-m]*$:
                regex: True
    - coalesce: True

The mask list can contain the following events (the default mask is create, delete, and modify):

  • access - File accessed

  • attrib - File metadata changed

  • close_nowrite - Unwritable file closed

  • close_write - Writable file closed

  • create - File created in watched directory

  • delete - File deleted from watched directory

  • delete_self - Watched file or directory deleted

  • modify - File modified

  • moved_from - File moved out of watched directory

  • moved_to - File moved into watched directory

  • move_self - Watched file moved

  • open - File opened

The mask can also contain the following options:

  • dont_follow - Don't dereference symbolic links

  • excl_unlink - Omit events for children after they have been unlinked

  • oneshot - Remove watch after one event

  • onlydir - Operate only if name is directory


Recursively watch files in the directory


Automatically start watching files that are created in the watched directory


Exclude directories or files from triggering events in the watched directory. Can use regex if regex is set to True


If this coalescing option is enabled, events are filtered based on their unicity, only unique events are enqueued, doublons are discarded. An event is unique when the combination of its fields (wd, mask, cookie, name) is unique among events of a same batch. After a batch of events is processed any events are accepted again. This option is top-level (at the same level as the path) and therefore affects all paths that are being watched. This is due to this option being at the Notifier level in pyinotify.


Validate the beacon configuration