Version française
Home     About     Download     Resources     Contact us    
Browse thread
How to monitor a specific file for changes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] How to monitor a specific file for changes
On Mon, Oct 22, 2007 at 03:03:35PM -0400, Orlin Grigorov wrote:
> This time I've done my research, but still I cannot find a good answer.
> Basically, I need to make a little ocaml process, which runs in the
> background and monitors a specific file for changes.   When a change occurs,
> I want it to back-up a copy of the version of the file at that moment.
> So, what I need is to set some signal or event, which will happen every time
> that file is changed.
> 
> Can you guys help me do it?

As well as the others mentioned, there is also Gamin which is a GNOME
API designed for this.  Originally there was a thing called FAM which
SGI invented, however it required a system-wide daemon.  Gamin is
FAM-compatible at the API level and uses the appropriate kernel calls
for the current operating system.

  http://www.gnome.org/~veillard/gamin/
  http://www.gnome.org/~veillard/gamin/differences.html

Although if current operating system != Linux, then YMMV.  Apparently
there are backends for Mac OS X, BSD & Solaris.

Gamin has an OCaml binding:

  http://svn.metaprl.org/viewvc/mojave/omake/src/clib/omake_notify.c?view=log&pathrev=1326

(well, really it's a FAM binding, but the APIs are supposed to be
compatible).

None of this works over NFS unfortunately.

Rich.

-- 
Richard Jones
Red Hat