adding exceptions to iwatch

In a previous article, we’ve seen how to install iwatch ( If you watch a directory with continuous changes, you may find useful to exclude specific types of files and/or directories.

Let’s say that you want to monitor a web server that hosts, site’s file structure at /var/www/ and media files mostly at /var/www/ Let’s say you want to skip monitoring /var/www/

Start by editing iwatch config:

nano /etc/iwatch/iwatch.xml

Add a watchlist like the following:

    <contactpoint email="[email protected]" name="Administrator"/>
    <path type="recursive">/var/www/</path>
    <path type="exception">/var/www/</path>
    <path type="regexception">.jpg</path>

What this watchlist does, is to monitor /var/www/ folder and its subdirectories, excluding any change under /var/www/ and any file containing .jpg in its file-name.

Notice that this syntax will also exclude hello.jpg.php from monitoring.

Try to be precise with your regex, or you will end up excluding more than you want.


Leave a Reply

Your email address will not be published. Required fields are marked *