URI: 
       twendy.1 - wendy - watch files/directories and run commands on any event
  HTML git clone git://z3bra.org/wendy
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       twendy.1 (3447B)
       ---
            1 .Dd 2013-06-02
            2 .Dt WENDY 1
            3 .Os POSIX.1-2008
            4 .Sh NAME
            5 .Nm wendy
            6 .Nd inotify based event watcher
            7 .Sh SYNOPSIS
            8 .Nm wendy
            9 .Op Fl acdlrv
           10 .Op Fl m Ar mask
           11 .Op Fl w Ar inode
           12 .Op command Op Ar args...
           13 .Sh DESCRIPTION
           14 .Nm
           15 watches for events in a directory or its files and executes
           16 .Ar cmd
           17 when an inotify event is triggered.
           18 .Bl -tag -width Ds
           19 .It Fl a
           20 Hidden mode. Entries whose name start with a . will be listed and trigger
           21 an event.
           22 .It Fl c
           23 Clear screen. Clear the screen whenever an event is triggered. This will
           24 occur before anything that would print something on screen (verbose mode,
           25 command output).
           26 .It Fl d
           27 Directory mode. Only directories will be watched, while regular
           28 files will be skipped (even if explicitely set with -w). See IN_ONLYDIR
           29 from
           30 .Xr inotify 7 .
           31 .It Fl l
           32 List events along with their numeric values.
           33 .It Fl r
           34 Recursive mode. Everytime an IN_CREATE event is triggered,
           35 a watch is added on the target file/directory.
           36 .It Fl v
           37 Verbose mode. Each triggered event is printed along with the path,
           38 as provided on the command line. In the case of directories, the path
           39 triggering the event is concatenated to the directory path.
           40 .It Fl m Ar mask
           41 Sets the mask for events you are interested in (see MASKS for more details).
           42 default: IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MODIFY|IN_MOVE|IN_MOVE_SELF|IN_CLOSE_WRITE
           43 .It Fl w Ar inode
           44 Specifies the file or directory to watch events in. You can specify multiple
           45 files by providing the
           46 .Fl w
           47 flag multiple times. If no watcher is added with the -w flag,
           48 .Nm
           49 will read path names from
           50 .Ar stdin ,
           51 one per line.
           52 .El
           53 .Sh MASKS
           54 The mask is a numeric value passed to inotify to specify the events that should
           55 be raised. Multiple events can be registered by summing them up, and passing
           56 the result to the
           57 .Fl m
           58 flag. The mask can take any of the values below, or a sum of them:
           59 
           60 .Bl -bullet -compact
           61 .It
           62 IN_ACCESS          1
           63 .It
           64 IN_MODIFY          2
           65 .It
           66 IN_ATTRIB          4
           67 .It
           68 IN_CLOSE_WRITE     8
           69 .It
           70 IN_CLOSE_NOWRITE   16
           71 .It
           72 IN_CLOSE           24
           73 .It
           74 IN_OPEN            32
           75 .It
           76 IN_MOVED_FROM      64
           77 .It
           78 IN_MOVED_TO        128
           79 .It
           80 IN_MOVE            192
           81 .It
           82 IN_CREATE          256
           83 .It
           84 IN_DELETE          512
           85 .It
           86 IN_DELETE_SELF     1024
           87 .It
           88 IN_MOVE_SELF       2048
           89 .It
           90 IN_ALL_EVENTS      4095
           91 .It
           92 IN_UNMOUNT         8192
           93 .El
           94 .Sh ENVIRONMENT
           95 .Bl -tag -width Ds
           96 .It Ev WENDY_INODE
           97 Name of the inode concerned by the event
           98 .It Ev WENDY_EVENT
           99 Name of the event triggered (eg. "CREATE")
          100 .El
          101 .Sh EXAMPLES
          102 Whenever an IN_CREATE (256) event is triggered in the Maildir folder
          103 INBOX, a sound is played:
          104 .Bd -literal
          105   wendy -m 256 -w ~/mail/INBOX/new play /usr/share/sound/bell.wav
          106 .Ed
          107 .Pp
          108 Use a sub-shell to print event name and path to stdout, showcasing the
          109 variables exported internally (this replicates the
          110 .Fl v
          111 switch):
          112 .Bd -literal
          113   wendy -m 768 -w . sh -c 'echo $WENDY_EVENT $WENDY_INODE'
          114 .Ed
          115 .Pp
          116 Rebuild a project when one of its source files changes:
          117 .Bd -literal
          118   find . -name '*.[ch]' | wendy make
          119 .Ed
          120 .Pp
          121 This example will only watch directory nodes, and will monitor every
          122 new directory created, thus propagating event monitoring inside the tree.
          123 Note that events happening on files withing these directories will
          124 still be reported, making the following command suitable for
          125 synchronizing two directories:
          126 .Bd -literal
          127   find /src -type d | wendy -rd -m 970 rsync -av --delete /src /dest
          128 .Ed
          129 .Sh SEE ALSO
          130 .Xr inotify 7 ,
          131 .Xr rsync 1
          132 .Sh AUTHORS
          133 .An Willy Goiffon Aq Mt dev@z3bra.org