On 11/15/05, Osho GG
Hi,
I would like to execute a scrit every time the /etc/resolv.conf file is modified. Is there a way to do that?
I am not aware of an effective solution with a script (except copying
the file to another place and checking for modifications on a regular
basis), but with kernel 2.6 you can utilize /dev/inotify which has
been developed for this purpose. IBM provides some example code that
compiles out of the box and monitors any directory.
inotify is outlined in here:
http://www-128.ibm.com/developerworks/linux/library/l-inotify.html
and code can found right at the botton. You can filter the events
(e.g. IN_MODIFY) you are willing to receive.
\Steve
--
Steve Graegert