ArchWiki / Incron
ArchWiki / Incron
es:Incron ja:Incron pt:Incron ru:Incron incron is an "inotify cron" system. It consists of a daemon and a table manipulator. You can use it a similar way as the regular cron. The difference is that the inotify cron handles filesystem events rather than time periods.
Installation
Activation and autostart
After installation, the daemon will not be enabled by default. You can enable incrond.service.
Configuration
Incrontabs should never be edited directly; instead, users should use the incrontab program to work with their incrontabs.
Using incrontab
To view their incrontabs, users should issue the command:
$ incrontab -lTo edit their incrontabs, they should use:
$ incrontab -eTo remove their incrontabs, they may use:
$ incrontab -rTo reload incrond, use:
$ incrontab -dTo edit another user's incrontab, isue the following command:
# incrontab -u user -eIncrontab format
Each row in an incrontab file is a table that the dameon runs when an event happens to a certain directory or file.
The basic format for an incrontab is:
path mask commandpath: the directory or file that incrond will monitor for changes.
mask: the type of filesystem event that incrond will monitor for. This paramter can be seperated by commas.
command: the command to be run after the specified filesystem event(s) occur.
Mask types
incrontab uses mask types to specify which file system event to monitor for. For more options see inotify(7)
To trigger a command if a file is accessed or read:
IN_ACCESSTo trigger a command if metadata of a file change (e.g. timestamps, permissons):
IN_ATTRIBTo trigger a command if a file opened for writing is closed:
IN_CLOSE_WRITETo trigger a command if a file or directory not opened for writing is closed:
IN_CLOSE_NOWRITETo trigger a command if a file or directory is created in a watched directory:
IN_CREATETo trigger a command if a file or directory is deleted from a watched directory:
IN_DELETETo trigger a command if a watched file or directory is deleted (or moved to a different filesystem):
IN_DELETE_SELFTo trigger a command if a file was modified:
IN_MODIFYTo trigger a command if a watched file or directory is moved within the filesystem:
IN_MOVE_SELFTo trigger a command if a file or directory is moved out of the watched directory:
IN_MOVED_FROMTo trigger a command if a file or directory is moved to the watched directory:
IN_MOVED_TOTo trigger a command if a watched file or directory is opened:
IN_OPENCustom Mask Types
Incrond provides additional custom event types to modify its monitoring behavior.
For instance, to pause monitoring an event until the current one is completely handled, add loopable=true to the event list, eg:
IN_CLOSE,loopable=trueAn event with the loopable event enabled will not fire again until the associated command exits.
See incrontab(5) for the complete list of custom mask types.