inotify-tools 3.13

inotify-tools is a set of command line utilities for the Linux inotify filesystem change notification system.
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:

· A bug that caused some command line options to be discarded was fixed.

last updated on:
January 2nd, 2008, 7:08 GMT
price:
FREE!
homepage:
rohanpm.net
license type:
GPL (GNU General Public License) 
developed by:
rohanpm.net
category:
ROOT \ Utilities
inotify-tools
Download Button

In a hurry? Add it to your Download Basket!

user rating 25

2.3/5
 

0/5

Rate it!

Add your review!

SUBMIT