inotify-tools 3.4 review

Download
by rbytes.net on

inotify-tools is a set of command line utilities for the Linux inotify filesystem change notification system. OK, so I made a litt

License: GPL (GNU General Public License)
File size: 0K
Developer: rohanpm.net
0 stars award from rbytes.net

inotify-tools is a set of command line utilities for the Linux inotify filesystem change notification system.

OK, so I made a little inotify command line utility to be called from shell scripts like so:
#!/bin/sh

while { inotifywait -e modify /var/log/messages; }; do
echo "Log modified!"
# Do some relevant command here
done

This is probably the most efficient way to block for changes on a file from a shell script. See 'inotifywait -help' for more info. I was originally thinking I'd put this up on sourceforge as a new project, but it's just too damn small.

If you don't specify which event you want to catch, all will be caught, and the event which occurred is output on stdout.

#!/bin/sh

EVENT=`inotifywait ~/file1`
[ $? = 0 ] && exit
[ “$EVENT" = “MODIFYµ ] && echo "file modified!"
[ “$EVENT" = “DELETE_SELF" ] && echo "file deleted!"
# etc...

inotifywait will return true if an event you asked for is caught. If an event you didn't ask for is caught, it will return false; this generally occurs if you listen to a file on a particular partition, then unmount that partition, or if you listen for a specific event and the file is deleted before that event occurs, or something similar.

What's New in This Release:
Files can now be selectively excluded when watching directories recursively.
The list of files to watch or exclude can now be read in from a file.

inotify-tools 3.4 search tags