Contents
How to use incron to monitor important files?
Close the file and those users can now execute the incrontab command without error. As you may have surmised, using incrontab is similar to using crontab. You would edit your incrontab file with the command incrontab -e. This command will open up the incrontab file for editing.
Where to put incrond config in a directory?
/etc/incron.d/ – This directory is examined by incrond for system table files. You should put all your config file here as per directory or domain names. /etc/incron.allow – This file contains users allowed to use incron. /etc/incron.deny – This file contains users denied to use incron.
How to run commands on file or directory changes with incron?
If you watch a directory, then $@ holds the directory path and $# the file that triggered the event. If you watch a file, then $@ holds the complete path to the file and $# is empty. If you need the wildcards but are not sure what they translate to, you can create an incron job like this.
How is incron similar to a cron command?
Incron is similar to cron, but instead of running commands based on time, it can trigger commands when file or directory events occur (e.g. a file modification, changes of permissions, etc.). System administrator permissions (root login). All commands in this tutorial should be run as root user on the shell.
Can you use incron if there is no incron deny?
Otherwise if /etc/incron.deny exists only users NOT listed here may use incron. If none of these files exists everyone is allowed to use incron. (Important note: This behavior is insecure and will be probably changed to be compatible with the style used by ISC Cron.)
How to trigger commands with incron on Debian 9?
This guide shows how you can install and use incron on a Debian 9 (Stretch) system. Incron is similar to cron, but instead of running commands based on time, it can trigger commands when file or directory events occur (e.g. a file modification, changes of permissions, etc.).