Using inotify to monitor the filesystem
|
Noteworthy
The number of monitored files supported by the kernel defines a value in the pseudo file /proc/sys/fs/inotify/max_user_watches . You will often find that the default values are quite low, 8,192 being a common number. You can easily exceed this limit if you perform test monitoring on a home directory that is somewhat full (Listing 4, Line 1 to 4). However, you can to adjust the value at any time using root rights (Listing 4, line 7).
Listing 4
Maximum notifications
01 $ inotifywatch -v -t 60 -r ~ 02 Establishing watches... 03 Setting up watch(es) on ~ 04 Failed to watch ~; upper limit on inotify watches reached! 05 $ cat /proc/sys/fs/inotify/max_user_watches 06 8192 07 $ echo 16384 | sudo tee /proc/sys/fs/inotify/max_user_watches 08 16384 09 $ cat /proc/sys/fs/inotify/max_user_watches 10 16384
When configuring programs like incron , it makes sense to proceed with caution. Tools like this are frequently used for monitoring larger directory trees. If you do not take extreme care, it is possible that endless loops may occur since incron deposits results in files that are located in monitored regions. In the worst case scenario, these kinds of loops can even crash a system.
Infos
- Inotify Tools: https://github.com/rvoicilas/inotify-tools
- iWatch: http://iwatch.sourceforge.net/index.html
- Documentation: http://iwatch.sourceforge.net/documentation.html
« Previous 1 2 3 Next »
Buy this article as PDF
Pages: 3
(incl. VAT)