watchtab
—
tables for driving filewatcherd
A watchtab
file contains instructions to the
filewatcherd(8)
daemon of the general form: ``run this command when these events happen to the
file at this path''.
Blank lines and leading spaces and tabs are ignored. Lines whose
first non-space character is a pound-sign (#) are comments, and are ignored.
Note that comments are not allowed on the same line as
watchtab
commands, since they will be taken to be
part of the command. Similarly, comments are not allowed on the same line as
environment variable settings.
An active line of a watchtab
will be
either an environment setting or a command. An environment setting is of the
form
where the spaces around the equal-sign (=) are optional, and any
subsequent non-leading spaces in value will be part of the
value assigned to name. Note that name
cannot contain any blackslash or tabulation.
Several environment variables are set up automatically by the
filewatcherd(8)
daemon. LOGNAME
and USER
are
set to the command user, HOME
is set to the home
directory of the command user, unless explicitly overriden.
TRIGGER
is set to the path that has triggered the
command execution.
The format of a watchtab
command is a
tabulation-separated sequence of fields, interpreted as follow:
- path
- Path of the file to watch
- events
- Set of events which trigger the command. It can either be a single
star-sign (*), or a punctuation-separated list of names among: DELETE,
WRITE, EXTEND, ATTRIB, LINK, RENAME and REVOKE. Their meaning is defined
in
kqueue(2)
for fflags for EVFILT_VNODE.
- delay
- Number of seconds, allowing a decimal point, between the trigger and when
the command is actually run.
- user
- User, and optionally group preceded by a colon sign (:), to change to
before running the command.
- chroot
- Path of a directory in which to chroot before running the command.
- command
- The command to run.
When less than 6 fields are given in a command line, the
chroot value is considered omitted, and chroot will be
performed. When less than 5 fields are given, the user
value is considered omitted, and no setuid or setgid will be performed. When
less than 4 fields are given, the delay value is
considered as zero. It is an error to provide less than 3 fields.