1incrontab(5) incron documentation incrontab(5)
2
3
4
6 incrontab - tables for driving inotify cron (incron)
7
9 An incrontab file contains instructions to the incrond(8) daemon of the
10 general form: "run this command on these file events". There are two
11 categories of tables: system tables (with root privileges) and user
12 tables (with user privileges).
13
14 System tables are (by default) located in /etc/incron.d and may have
15 any names. Each system table exists separately inside incron and their
16 watches never collide.
17
18 Each user has their own table, and commands in any given incrontab will
19 be executed as the user who owns the incrontab. System users (such as
20 apache, postfix, nobody etc.) may have their own incrontab.
21
22 incrontab files are read when the incrond(8) daemon starts and after
23 any change (incrontab file are being hooked when incrond is running).
24
25 Blank lines are ignored. The general line format is the following:
26
27 <path> <mask> <command>
28
29 Where path is an absolute filesystem path, mask is an event mask (in
30 symbolic or numeric form) and command is an executable file (or a
31 script) with its arguments. See bellow for event mask symbols. The exe‐
32 cutable file may be noted as an absolute path or only as the name
33 itself (PATH locations are examined).
34
35 Please remember that the same path may occur only once per table (oth‐
36 erwise only the first occurrence takes effect and an error message is
37 emitted to the system log).
38
40 These basic event mask symbols are defined:
41
42 IN_ACCESS File was accessed (read) (*)
43 IN_ATTRIB Metadata changed (permissions, timestamps, extended
44 attributes, etc.) (*)
45 IN_CLOSE_WRITE File opened for writing was closed (*)
46 IN_CLOSE_NOWRITE File not opened for writing was closed (*)
47 IN_CREATE File/directory created in watched directory (*)
48 IN_DELETE File/directory deleted from watched directory (*)
49 IN_DELETE_SELF Watched file/directory was itself deleted
50 IN_MODIFY File was modified (*)
51 IN_MOVE_SELF Watched file/directory was itself moved
52 IN_MOVED_FROM File moved out of watched directory (*)
53 IN_MOVED_TO File moved into watched directory (*)
54 IN_OPEN File was opened (*)
55
56 When monitoring a directory, the events marked with an asterisk (*)
57 above can occur for files in the directory, in which case the name
58 field in the returned event data identifies the name of the file within
59 the directory.
60
61 The IN_ALL_EVENTS symbol is defined as a bit mask of all of the above
62 events. Two additional convenience symbols are IN_MOVE, which is a com‐
63 bination of IN_MOVED_FROM and IN_MOVED_TO, and IN_CLOSE which combines
64 IN_CLOSE_WRITE and IN_CLOSE_NOWRITE.
65
66 The following further symbols can be specified in the mask:
67
68 IN_DONT_FOLLOW Don't dereference pathname if it is a symbolic link
69 IN_ONESHOT Monitor pathname for only one event
70 IN_ONLYDIR Only watch pathname if it is a directory
71
72 Additionaly, there is a symbol which doesn't appear in the inotify sym‐
73 bol set. It it IN_NO_LOOP. This symbol disables monitoring events until
74 the current one is completely handled (until its child process exits).
75
76
78 The following wildards may be used inside command specification:
79
80 $$ dollar sign
81 $@ watched filesystem path (see above)
82 $# event-related file name
83 $% event flags (textually)
84 $& event flags (numerically)
85
86
88 These are some example rules which can be used in an incrontab file:
89
90 /tmp IN_ALL_EVENTS abcd $@/$# $%
91
92 /usr/bin IN_ACCESS,IN_NO_LOOP abcd $#
93
94 /home IN_CREATE /usr/local/bin/abcd $#
95
96 /var/log 12 abcd $@/$#
97
98 The first line monitors all events on the /tmp directory. When an event
99 occurs it runs a application called 'abcd' with the full path of the
100 file as the first arguments and the event flags as the second one.
101
102 The second line monitors accesses (readings) on the /usr/bin directory.
103 The application 'abcd' is run as a handler and the appropriate event
104 watch is disabled until the program finishes. The file name (without
105 the directory path) is passed in as an argument.
106
107 The third example is used for monitoring the /home directory for newly
108 create files or directories (it practically means an event is sent when
109 a new user is added). This event is processed by a program specified by
110 an absolute path.
111
112 And the final line shows how to use numeric event mask instead of tex‐
113 tual one. The value 12 is exactly the same as IN_ATTRIB,IN_CLOSE_WRITE.
114
115
117 incrond(8), incrontab(1), incron.conf(5)
118
120 Lukas Jelinek <lukas@aiken.cz> (please report bugs to
121 http://bts.aiken.cz or <bugs@aiken.cz>).
122
124 This program is free software. It can be used, redistributed and/or
125 modified under the terms of the GNU General Public License, version 2.
126
127
128
129Lukas Jelinek 0.5.9 incrontab(5)