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=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id D7B2CBC69 for ; Mon, 22 Oct 2007 21:20:07 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAIOUHEfAXQInh2dsb2JhbACOVwEBAQgKKZN0 X-IronPort-AV: E=Sophos;i="4.21,312,1188770400"; d="scan'208";a="18479869" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 22 Oct 2007 21:20:07 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l9MJK5Pq031048 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 22 Oct 2007 21:20:07 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAPqUHEfa1uFinmdsb2JhbACOVwEBAQEHBAYRGJN2 X-IronPort-AV: E=Sophos;i="4.21,312,1188770400"; d="scan'208";a="4976164" Received: from smtp.syd.people.net.au ([218.214.225.98]) by mail3-smtp-sop.national.inria.fr with SMTP; 22 Oct 2007 21:20:04 +0200 Received: (qmail 6086 invoked from network); 22 Oct 2007 19:20:26 -0000 Received: from unknown (HELO hendrix.mega-nerd.net) (218.214.64.136) by smtp.syd.people.net.au with SMTP; 22 Oct 2007 19:20:26 -0000 Received: from hendrix (hendrix [192.168.200.99]) by hendrix.mega-nerd.net (Postfix) with SMTP id 02BD1AB1D1 for ; Tue, 23 Oct 2007 05:20:02 +1000 (EST) Date: Tue, 23 Oct 2007 05:20:01 +1000 From: Erik de Castro Lopo To: caml-list@inria.fr Subject: Re: [Caml-list] How to monitor a specific file for changes Message-Id: <20071023052001.517e957e.mle+ocaml@mega-nerd.com> In-Reply-To: References: Reply-To: caml-list@inria.fr Organization: Erik Conspiracy Secret Labs X-Mailer: Sylpheed 2.4.5 (GTK+ 2.12.0; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 471CF7E5.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 bindings:01 monitors:98 dorothy:98 parker:98 wrote:01 unix:01 caml-list:01 rarely:02 erik:04 erik:04 women:93 linux:07 background:91 Orlin Grigorov wrote: > Hi. > > 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. If you are on Linux/Unix, have a look at Inotify. The Ocaml bindings are here: http://tab.snarc.org/projects/ocaml_inotify/ HTH, Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "Well behaved women rarely make history." -- Dorothy Parker