---

Linux incrond inotify: Monitor Directories For Changes And Take Action

[ Thanks to An Anonymous Reader for
this link. ]

“I want to copy (rsync to remote server) a directory
tree whenever file uploaded or deleted in /var/www/html/upload/
directory under Linux operating systems for backup purpose and/or
load balancing purpose without getting into complex file sharing
setup such as NFS or GFS iscsi storage. How do I monitor
/var/www/html/upload/ and its subdirectory for new files and
executes rsync command to make copy back to
www2.example.com:/var/www/html/upload/?

“inotify is an inode-based filesystem notification technology.
It provides possibility to simply monitor various events on files
in filesystems. It is a very much powerful replacement of
(obsolete) dnotify. inotify brings a comfortable way how to manage
files used in your applications.

“The incrond (inotify cron daemon) is a daemon which monitors
filesystem events (such as add a new file, delete a file and so on)
and executes commands or shell scripts. It’s use is generally
similar to cron.”


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis