Home > English > Knowledge Base > Explore Incrond

Explore Incrond

 

What is incrond?

 Incrond (inotify cron daemon) is a daemon which keep track of file system events (such as adding a new file, remove a file, etc) and follow commands or shell scripts . Generally, it is quite similar to crond with an exception that if the source folder changes, the goal folder will change too

inotify is a technology to inform of the inode file system. It simply keeps track of different events on files of the system. It is a strong replacement of dnotify. Inotify manages files in your applications in a comfortable way 

Install incron

# yum install incron -y

Start it together with the system

# service incrond start
# chkconfig incrond on

Configuration files of incrond

  • /etc/incron.conf – Main configuration file of  incron.
  • /etc/incron.d/ – This directory is checked by icrond for files of table system. You should set all of your configuration files here as folders or domains
  • /etc/incron.allow – This file contains users who can use incron.
  • /etc/incron.deny – This file contains users denying using incron.
  • /var/spool/incron – This directory allows incrond to check user board files which is set up by users running incrontab commands 

incron syntax:

<directory> <file change mask> <command or action>  options

Eg:

/var/www/html IN_CREATE /root/scripts/backup.sh
/sales IN_DELETE /root/scripts/sync.sh
/var/named/chroot/var/master IN_CREATE,IN_ATTRIB,IN_MODIFY /sbin/rndc reload