From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 02FB8BC69 for ; Wed, 24 Oct 2007 14:53:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAFbcHkdQRFuw/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.21,324,1188770400"; d="scan'208";a="5049673" Received: from furbychan.cocan.org ([80.68.91.176]) by mail3-smtp-sop.national.inria.fr with ESMTP; 24 Oct 2007 14:53:31 +0200 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1Ikfji-0003O2-00; Wed, 24 Oct 2007 13:53:26 +0100 Date: Wed, 24 Oct 2007 13:53:26 +0100 To: Orlin Grigorov Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] How to monitor a specific file for changes Message-ID: <20071024125325.GA12110@furbychan.cocan.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: Richard Jones X-Spam: no; 0.00; ocaml:01 ocaml:01 monitors:98 wrote:01 caml-list:01 api:02 api:02 kernel:02 binding:02 binding:02 apis:03 bsd:04 src:94 nfs:06 differences:06 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