incrontab(5)
πΈ NAME πΈ
incrontab β tables for driving inotify cron (incron) π
Okay bestie, welcome to incrontab(5) β the incron documentation page that explains these incrontab files, and it is lowkey the blueprint for telling the incrond(8) daemon what to do. π«Ά
β¨ DESCRIPTION β¨
An incrontab file contains instructions to the incrond(8) daemon of the general form: βrun this command on these file events.β π There are two categories of tables: system tables (with root privileges) and user tables (with user privileges).
System tables are (by default) located in /etc/incron.d and may have any names. Each system table exists separately inside incron and their watches never collide. No cap, they stay in their own lane. π¦
Each user has their own table, and commands in any given incrontab will be executed as the user who owns the incrontab. System users (such as apache, postfix, nobody etc.) may have their own incrontab. Yes bestie, even the service accounts can have a little main character energy. π
incrontab files are read when the incrond(8) daemon starts and after any change (incrontab files are being hooked when incrond is running).
Blank lines are ignored. Periodt. The general line format is the following:
<path> <mask> <command>
Where path is an absolute filesystem path, mask is an event mask (in symbolic or numeric form) and command is an executable file (or a script) with its arguments. See below for event mask symbols. The executable file may be noted as an absolute path or only as the name itself (PATH locations are examined).
Please remember that the same path may occur only once per table (otherwise only the first occurrence takes effect and an error message is emitted to the system log). Also please note that the * wildcard is allowed to observe a range of files. Donβt try to sneak duplicate paths in there, bestie β itβs not the vibe. π
π EVENT SYMBOLS π
These basic event mask symbols are defined, and they are giving very specific file-event lore:
IN_ACCESSβ File was accessed (read)(*)IN_ATTRIBβ Metadata changed (permissions, timestamps, extended attributes, etc.)(*)IN_CLOSE_WRITEβ File opened for writing was closed(*)IN_CLOSE_NOWRITEβ File not opened for writing was closed(*)IN_CREATEβ File/directory created in watched directory(*)IN_DELETEβ File/directory deleted from watched directory(*)IN_DELETE_SELFβ Watched file/directory was itself deletedIN_MODIFYβ File was modified(*)IN_MOVE_SELFβ Watched file/directory was itself movedIN_MOVED_FROMβ File moved out of watched directory(*)IN_MOVED_TOβ File moved into watched directory(*)IN_OPENβ File was opened(*)
When monitoring a directory, the events marked with an asterisk (*) above can occur for files in the directory, in which case the name field in the returned event data identifies the name of the file within the directory. That name field is doing the detective work, iykyk. π
The IN_ALL_EVENTS symbol is defined as a bit mask of all of the above events. Two additional convenience symbols are IN_MOVE, which is a combination of IN_MOVED_FROM and IN_MOVED_TO, and IN_CLOSE which combines IN_CLOSE_WRITE and IN_CLOSE_NOWRITE.
The following further symbols can be specified in the mask:
IN_DONT_FOLLOWβ Donβt dereference pathname if it is a symbolic linkIN_ONESHOTβ Monitor pathname for only one eventIN_ONLYDIRβ Only watch pathname if it is a directory
Additionally, there is a symbol which doesnβt appear in the inotify symbol set. It is loopable=true. This symbol disables monitoring events until the current one is completely handled (until its child process exits). Also, there is the symbol recursive=false. This symbol limits the observation on the specified directory and does not include subdirectories. Finally, there is also the symbol dotdirs=true. This symbol will include the hidden directories (where the names starts with a dot) in the observation. Hidden dirs? In this economy? Apparently yes. π
π¦ WILDCARDS π¦
The following wildcards may be used inside command specification. They are your little command-line besties:
$$β dollar sign$@β watched filesystem path (see above)$#β event-related file name$%β event flags (textually)$&β event flags (numerically)
π EXAMPLE π
These are some example rules which can be used in an incrontab file. Copy the energy, not the typos, bestie:
/tmp IN_ALL_EVENTS abcd $@/$# $%
/usr/bin IN_ACCESS,loopable=true abcd $#
/home IN_CREATE /usr/local/bin/abcd $#
/home IN_CREATE,dotdirs=true /usr/local/bin/abcd $#
/home IN_CREATE,recursive=false /usr/local/bin/abcd $#
/var/log 12 abcd $@/$#
First line: monitors all events on the /tmp directory. When an event occurs it runs an application called abcd with the full path of the file as the first argument and the event flags as the second one.
Second line: monitors accesses (readings) on the /usr/bin directory. The application abcd is run as a handler and the appropriate event watch is disabled until the program finishes. The file name (without the directory path) is passed in as an argument.
Third example: is used for monitoring the /home directory for newly created files or directories (it practically means an event is sent when a new user is added). This event is processed by a program specified by an absolute path.
Fourth example: is the third example, but it will include hidden directories in the observation.
Fifth example: is the third example, but it will exclude sub-directories from the observation.
Final line: shows how to use numeric event mask instead of textual one. The value 12 is exactly the same as IN_ATTRIB,IN_CLOSE_WRITE.
π₯ SEE ALSO π₯
Go look at these when you need the full lore: incrond(8), incrontab(1), incron.conf(5). β¨
π AUTHOR π
Andreas Altair Redmer <altair.ibn.la.ahad.sy@gmail.com> (please report bugs to https://github.com/ar-/incron/issues ). Lukas Jelinek <lukas@aiken.cz> .
π COPYING π
This program is free software. It can be used, redistributed and/or modified under the terms of the GNU General Public License, version 2. Slay, open source. π
Later bestie β footer source/version credit goes to Lukas Jelinek, version 0.5.12, and incrontab(5); thereβs literally no date line in the footer, so no fake date, fr fr. π
π¦ where this page comes from
- alpine 3.24: incron-doc 0.5.12-r0 Β· GPL-2.0
- epel 10: incron 0.5.12-28.el10_2 Β· GPL-2.0-only
- epel 9: incron 0.5.12-21.el9 Β· GPLv2
- fedora 43: incron 0.5.12-28.fc43 Β· GPL-2.0-only
- fedora 44: incron 0.5.12-29.fc44 Β· GPL-2.0-only
- nixos 26.05: incron 0.5.12
- nixpkgs unstable: incron 0.5.12
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms