Trigger on file change

Daniel Bye dan at slightlystrange.org
Tue May 13 04:58:45 PDT 2003


On Tue, May 13, 2003 at 01:47:31PM +0200, Guy Van Sanden wrote:
> I need to have a script run everytime a file changes.
> The file only changes once every month (tops), but the script needs to
> be run rather fast after the change (5-10 minutes)
> 
> I thought of leaving the script looping, making a checksum / date check
> every time and sleeping the rest, but it seems like a lot of overhead
> (disk access).
> 
> Does anyone know of a utility that can do this, possibly one that can
> monitor filehandlers in the kernel?

No, but another idea comes to mind - what sort of file is it?  If it is a
text file, and it is changed by a human operator, could you roll a wrapper
for their editor that will perform the necessary actions upon save and exit?
This way, no need for an additional external script at all.  Even if it is
copied from the network, something similar would be possible, I'm sure.

Just a thought.

Dan

-- 
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: 3D73 AF47 D448 C5CA 88B4 0DCF 849C 1C33 3C48 2CDC
                                                                     _
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \


More information about the freebsd-questions mailing list