In a previous article, we’ve seen how to install iwatch (http://blog.grs.gr/?p=455&lang=en). 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 example.com, site’s file structure at /var/www/example.com
and media files mostly at /var/www/example.com/uploads
. Let’s say you want to skip monitoring /var/www/example.com/uploads
.
Start by editing iwatch config:
nano /etc/iwatch/iwatch.xml
Add a watchlist like the following:
<watchlist> <title>test</title> <contactpoint email="[email protected]" name="Administrator"/> <path type="recursive">/var/www/example.com</path> <path type="exception">/var/www/example.com/uploads</path> <path type="regexception">.jpg</path> </watchlist>
What this watchlist does, is to monitor /var/www/example.com
folder and its subdirectories, excluding any change under /var/www/example.com/uploads
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