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=1.2 required=5.0 tests=AWL,HTML_MESSAGE,SPF_NEUTRAL 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 B7151BC69 for ; Mon, 22 Oct 2007 21:30:19 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJ6WHEfRVYa8mGdsb2JhbACCPTWLZQEBAQEHBAQTGA X-IronPort-AV: E=Sophos;i="4.21,312,1188770400"; d="scan'208";a="18480184" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 22 Oct 2007 21:30:19 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l9MJUISW031203 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 22 Oct 2007 21:30:18 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJ6WHEfRVYa8mGdsb2JhbACCPTWLZQEBAQEHBAQTGA X-IronPort-AV: E=Sophos;i="4.21,312,1188770400"; d="scan'208";a="18480183" Received: from mu-out-0910.google.com ([209.85.134.188]) by mail4-smtp-sop.national.inria.fr with ESMTP; 22 Oct 2007 21:30:18 +0200 Received: by mu-out-0910.google.com with SMTP id w9so2074774mue for ; Mon, 22 Oct 2007 12:30:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=OOdHjWJ2FDiFQORqmMPKYeVFgMiE8HU0o+Zd4z9yHEk=; b=ZofUWr2BTv8QDkuyrlWxIiQfzD0ZmsUgdwha/hVtjhtQz4hVeO1ZigNXTemjO2/0AogqVLs9myKZPAXVFWaTbBW8Bs3h+S/XDGO3QeqtOvK5WpjJbHCx5U4dw4CmMucbPYH5CPl9BvaOFGD3eaFQ7rE6qTRO+fPpBmDcF0jLjvQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=fRGXUNd/+1kUJSxH55nMkDWbT0cggBgn3qGmJY9ZXMugRPmj0OvTBPHy+92kp4Loadwq5R7Qwg5Gx47/adi3axWWFgqyc+UjeyCTzDpu2lGtO+6G8/7RMxHHPIL8x8CNhVBY1eL3FHXNlwN0leeaiFXH4efuvLvhXpTT/hqIu8s= Received: by 10.82.165.13 with SMTP id n13mr1101558bue.1193081417056; Mon, 22 Oct 2007 12:30:17 -0700 (PDT) Received: by 10.82.120.16 with HTTP; Mon, 22 Oct 2007 12:30:17 -0700 (PDT) Message-ID: Date: Mon, 22 Oct 2007 15:30:17 -0400 From: "Orlin Grigorov" To: caml-list@inria.fr Subject: Re: [Caml-list] How to monitor a specific file for changes In-Reply-To: <20071023052001.517e957e.mle+ocaml@mega-nerd.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_22729_16381571.1193081417043" References: <20071023052001.517e957e.mle+ocaml@mega-nerd.com> X-Miltered: at discorde with ID 471CFA4A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 bindings:01 beginner's:01 bug:01 bindings:01 beginner's:01 bug:01 monitors:98 dorothy:98 parker:98 monitors:98 dorothy:98 parker:98 beginners:01 ------=_Part_22729_16381571.1193081417043 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Well, I'm developing my application in Linux, but after it's done, it will be used mostly on Mac OS. So far, on regular basis, I test everything on my Mac to make sure it's working. I guess I'll have to find another way then. One idea I have is to poll the size of the file every certain amount of time, and if it's different---there's my event. Same applies to "date/time last modified". Is there something I can use successfully on both Linux and Mac about that? Just to mention that the file is a text file, and it doesn't change very often. I mean, it's not constantly changing, so I'm not concerned with performance and resource issues. Oh, here's another idea---every certain amount of time, I just compare my last saved version of the file to the current one---if different, there's my event. What do you think? O. On 10/22/07, Erik de Castro Lopo wrote: > > 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 > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > ------=_Part_22729_16381571.1193081417043 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Well, I'm developing my application in Linux, but after it's done, it will be used mostly on Mac OS.  So far, on regular basis, I test everything on my Mac to make sure it's working.  

I guess I'll have to find another way then.   One idea I have is to poll the size of the file every certain amount of time, and if it's different---there's my event.   Same applies to "date/time last modified".

Is there something I can use successfully on both Linux and Mac about that?

Just to mention that the file is a text file, and it doesn't change very often.  I mean, it's not constantly changing, so I'm not concerned with performance and resource issues.

Oh, here's another idea---every certain amount of time, I just compare my last saved version of the file to the current one---if different, there's my event.   What do you think?

O.

On 10/22/07, Erik de Castro Lopo <mle+ocaml@mega-nerd.com> wrote:
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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

------=_Part_22729_16381571.1193081417043--