This tutorial shows you how you can use incron on an Ubuntu 16.04 system to run commands when a file or directory is changed. The incron daemon is similar to cron, but instead of running commands based on time, it can trigger commands when a file or directory event occurs (e.g. a file modification, changes of permissions, etc.).
Original URL: https://www.howtoforge.com/tutorial/how-to-run-commands-on-file-or-directory-changes-with-incron-on-ubuntu-16-04/