caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Orlin Grigorov" <ogrigorov@gmail.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] How to monitor a specific file for changes
Date: Mon, 22 Oct 2007 15:30:17 -0400	[thread overview]
Message-ID: <b17e12b30710221230t15374864ha746026f45f2dbb4@mail.gmail.com> (raw)
In-Reply-To: <20071023052001.517e957e.mle+ocaml@mega-nerd.com>

[-- Attachment #1: Type: text/plain, Size: 2048 bytes --]

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
>

[-- Attachment #2: Type: text/html, Size: 2847 bytes --]

  reply	other threads:[~2007-10-22 19:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 19:03 Orlin Grigorov
2007-10-22 19:05 ` [Caml-list] " Robert Fischer
2007-10-22 19:09 ` Sylvain Le Gall
2007-10-22 19:11 ` [Caml-list] " Andrew Gacek
2007-10-22 19:20 ` Erik de Castro Lopo
2007-10-22 19:30   ` Orlin Grigorov [this message]
2007-10-22 19:38     ` Erik de Castro Lopo
2007-10-22 19:39     ` Jake Donham
2007-10-22 19:44       ` Orlin Grigorov
2007-10-22 19:42     ` Karl Zilles
2007-10-22 19:57       ` Orlin Grigorov
2007-10-23  7:50         ` Dave Benjamin
2007-10-23 17:17           ` Orlin Grigorov
2007-10-24 12:54       ` Richard Jones
2007-10-24 18:14         ` Karl Zilles
2007-10-24 21:56           ` Sylvain Le Gall
2007-10-22 19:43     ` Re : [Caml-list] " Adrien
2007-10-22 19:59 ` Gordon Henriksen
2007-10-24 12:53 ` Richard Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b17e12b30710221230t15374864ha746026f45f2dbb4@mail.gmail.com \
    --to=ogrigorov@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).