fam
[Top] [All Lists]

Re: Shell interface to fam ?

To: "Kaloudoff Olivier" <kaloudoff@xxxxxxxxxx>
Subject: Re: Shell interface to fam ?
From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
Date: Wed, 06 Nov 2002 17:31:26 +0000
Cc: fam@xxxxxxxxxxx
In-reply-to: <OF875FAFC0.C363F8E1-ONC1256C69.004E54DF@xxxxxxxxxx>
References: <OF875FAFC0.C363F8E1-ONC1256C69.004E54DF@xxxxxxxxxx>
Sender: fam-bounce@xxxxxxxxxxx
On 6 Nov, you wrote:
> 
>      but this filechanged utility looses all benefits of the FAM system.
> What I need is a tool much like procmail uses to lock files;
> 
> - my shell script would call, for example "/usr/bin/fam-wait filename " , a
> call
> that would block until the file has been changed.
> 
> Ok, I'll try to write cut and paste some C code to get this behaviour ...
> (I wish I was a C programmer)

It can't be hard to modify fileschanged to exit after the first file
change. Failing that, there are a few shell tricks you can use:

  f() { fileschanges -f some_file | return }

seems to actually work in zsh. Failing that, you can use a fifo manually
instead of a pipe:

  mknod /tmp/pipe f
  fileschanged -f some_file >/tmp/pipe &
  read </tmp/pipe  # block until something found on /tmp/pipe

  kill $!  # kill fileschanged process
  rm /tmp/pipe

In zsh or ksh, you could use a coprocess instead of the fifo. And, there
may be other ways.

Oliver

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only.  It may contain proprietary material, confidential 
information and/or be subject to legal privilege.  It should not be copied, 
disclosed to, retained or used by, any other party.  If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender.  Thank you.

<Prev in Thread] Current Thread [Next in Thread>