Manual Page Search Parameters

WENDY(1) General Commands Manual WENDY(1)

wendyinotify based event watcher

wendy [-acdlrv] [-m mask] [-w inode] [command [args...]]

wendy watches for events in a directory or its files and executes cmd when an inotify event is triggered.

Hidden mode. Entries whose name start with a . will be listed and trigger an event.
Clear screen. Clear the screen whenever an event is triggered. This will occur before anything that would print something on screen (verbose mode, command output).
Directory mode. Only directories will be watched, while regular files will be skipped (even if explicitely set with -w). See IN_ONLYDIR from inotify(7).
List events along with their numeric values.
Recursive mode. Everytime an IN_CREATE event is triggered, a watch is added on the target file/directory.
Verbose mode. Each triggered event is printed along with the path, as provided on the command line. In the case of directories, the path triggering the event is concatenated to the directory path.
mask
Sets the mask for events you are interested in (see MASKS for more details). default: IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MODIFY|IN_MOVE|IN_MOVE_SELF|IN_CLOSE_WRITE
inode
Specifies the file or directory to watch events in. You can specify multiple files by providing the -w flag multiple times. If no watcher is added with the -w flag, wendy will read path names from stdin, one per line.

The mask is a numeric value passed to inotify to specify the events that should be raised. Multiple events can be registered by summing them up, and passing the result to the -m flag. The mask can take any of the values below, or a sum of them:

  • IN_ACCESS 1
  • IN_MODIFY 2
  • IN_ATTRIB 4
  • IN_CLOSE_WRITE 8
  • IN_CLOSE_NOWRITE 16
  • IN_CLOSE 24
  • IN_OPEN 32
  • IN_MOVED_FROM 64
  • IN_MOVED_TO 128
  • IN_MOVE 192
  • IN_CREATE 256
  • IN_DELETE 512
  • IN_DELETE_SELF 1024
  • IN_MOVE_SELF 2048
  • IN_ALL_EVENTS 4095
  • IN_UNMOUNT 8192

Name of the inode concerned by the event
Name of the event triggered (eg. "CREATE")

Whenever an IN_CREATE (256) event is triggered in the Maildir folder INBOX, a sound is played:

  wendy -m 256 -w ~/mail/INBOX/new play /usr/share/sound/bell.wav

Use a sub-shell to print event name and path to stdout, showcasing the variables exported internally (this replicates the -v switch):

  wendy -m 768 -w . sh -c 'echo $WENDY_EVENT $WENDY_INODE'

Rebuild a project when one of its source files changes:

  find . -name '*.[ch]' | wendy make

This example will only watch directory nodes, and will monitor every new directory created, thus propagating event monitoring inside the tree. Note that events happening on files withing these directories will still be reported, making the following command suitable for synchronizing two directories:

  find /src -type d | wendy -rd -m 970 rsync -av --delete /src /dest

inotify(7), rsync(1)

Willy Goiffon <dev@z3bra.org>

2013-06-02 POSIX.1-2008