incron FAQ (Frequently Asked Questions)
Q: What is incron?
incron is an inotify cron system.
See About for more details.
Q: What can I use incron for?
incron can be used for many situations where something depends on
file system events. See Why to use for more details.
Q: Are there some distribution (binary) packages?
There are some packages provided by third parties. Please see Links
for such packages. You can also check your distribution whether there is a package named 'incron'.
Q: How does it work?
incron has two parts: a daemon and a table manipulator. The daemon reads
rules from system and user tables, creates appropriate watches on files and
waits for events. If an event occurs the daemon run a command (an executable file
with parameters). Any changes in the tables are reflected immediately.
Q: How to add/modify/remove a system table?
System tables are located in /etc/incron.d. These files are intended to be
modified directly. Simply add, edit or remove such file.
Q: How to add/modify/remove an user table?
User tables are located in /var/spool/incron but they are not intended to be
modified directly (although root can do so). Please use incrontab for any
Q: Why such complex solution? I want to have my table in my home directory!
incron use the same model as cron. There are more reasons why its better to
have user tables in one special directory. Some users may share one home
directory and some of them have / as their home (especially some system accounts).
If an user want to maintain his table in his home directory, he can. But it
will always be only a "work copy" with must be (using incrontab) copied into the regular
Q: How to write incron rules?
incron tables have one rule per row. Each rule has three parts. The first one is
an absolute path to the file which have to be watched. The second one is an event
mask containing all events which will be passed in (one or more comma separated symbols
or eventually a numeric value). And the last one is a command
to run. The parts are separated by one or more spaces. If you want to use spaces
inside the file path or the command you must prepend each such characted by
a backslash. Each real backslash must be doubled of course.
Q: What is IN_NO_LOOP?
In some cases, looping may occur (e.g. if you run 'chmod' as a reaction on
IN_ATTRIB). To avoid this behavior you can use a special symbol, IN_NO_LOOP.
It temporarily disables watching (all events for the given rule) and after
processing the event it is enabled again. This disabling means that such events
are not reported by the kernel to incron (ie. they are lost).
Q: How does incron handles IN_ONESHOT?
Immediately after the first event is occurred the watch is disabled. It means
this event can occur only once until incrond is restarted or the table is
Q: Is it better to use IN_MODIFY or IN_CLOSE_WRITE?
Solution of this dilemma (and some related things) is described in
the inotify FAQ
Q: How to use event properties in commands?
There are a few special symbols starting with a dollar sign ($). These
symbols may be used everywhere in command definitions. See Documentation
for more details.
Q: Is it possible to specify an user to run a command under?
Not yet. It will be implemented in future versions. But regular users will never
have this right of course.
Q: Can I catch outputs of executed commands?
It can be currently done only indirectly. You create a script which
runs the appropriate program and redirects the outputs (stdout and stderr).
Direct implementation is planned for future versions, probably including
the possibility to send this data via e-mail.
Q: What privileges does incron use for commands?
Commands generated by system tables have root privileges. Commands from user
tables have privileges of the appropriate user.
Q: Can I run incrond on foreground?
Yes (since 0.4.0). Specify -n or --foreground in the command line.
Q: Can I simply terminate a running instance of incrond?
Yes (since 0.4.0). Specify -k or --kill in the command line.
Q: Can I use my own editor?
Yes. Export the EDITOR variable (e.g. export EDITOR=nano). Since 0.4.0 also VISUAL is accepted (with
lower priority than EDITOR) and if an "alternative" editor is defined
(/etc/alternatives/editor) it is used in preference to the hard-wired one.
Q: How does incrond log its actions?
incrond actions are logged through syslog as the cron facility. The typical
log file is /var/log/cron but it may differ across distributions.
Q: How the environment variables are treated?
There is currently no feature how to specify enviroment variables
for executed commands directly (if you want to do this, please write
a script and set those variables here) although it's planned for the
future. For system tables, incrond's enviroment variables are used
without any changes. The same applies for root's user table. For non-root
user, the whole environment is cleared and then some of the variables
are set (LOGNAME, USER, USERNAME, HOME, SHELL and PATH) using the
values from the user database. PATH is set to
Q: What about licensing?
incron is licensed under the GNU General Public License, version 2.
Some parts (e.g. inotify-cxx) may be licensed under additional licenses too.
Q: How to report bugs?
If you find a bug or have a suggestion, you can report it through the
Bug Tracking System.
Q: incron is nice! I want to support its development.
make a donation
through PayPal. If you do this then 5 % of the total amount
will be tranferred to Electronic Frontier Foundation
(a non-profit group established to protect freedom in the digital world).
Thanks for any help!