Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Dec 2008 18:14:06 +0200
From:      Danny Braniss <danny@cs.huji.ac.il>
To:        rihad <rihad@mail.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: preventing FIFO from EOF 
Message-ID:  <E1LBAeU-00086X-I3@kabab.cs.huji.ac.il>
In-Reply-To: <49426B64.1070004@mail.ru> 
References:  <494235CA.2050101@mail.ru> <E1LB7zz-0006kU-SU@kabab.cs.huji.ac.il> <49426B64.1070004@mail.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
> Danny Braniss wrote:
> >> $ mkfifo /var/tmp/foo
> >> $ buffer -i /var/tmp/foo                    # misc/buffer
> >> # in another console:
> >> $ echo hi > /var/tmp/foo
> >>
> >> buffer prints hi and exits. I want it to keep reading and printing 
> >> indefinitely.
> >>
> >> Further experimentation revealed that I need two writers: one dummy 
> >> writer that just keeps /var/tmp/foo open for writing, and the other 
> >> doing the "real work". This way buffer wouldn't exit. But how to emulate 
> >> the dummy writer? It itself needs to block on something to keep 
> >> /var/tmp/foo open. Any clean way to do this in shell? Maybe the solution 
> >> is quite simple but isn't at the tip of my tongue.
> >>
> >> Thanks.
> > 
> > too easy
> > n csh:
> > 	while 1
> > 		buffer -i /var/tmp/foo 
> > 	end
> > or in sh:
> > 	while true; do
> > 		buffer -i /var/tmp/foo
> > 	done
> > 
> 
> > Thanks, but I should have said that buffer must always run to never miss any data. 
> 
> The reason being that buffer's output gets fed into another program that 
> shouldn't be restarted.

use 'tail -f' instead of 'buffer -i' then, or place the while in file
and execute that. BTW, buffer was written way back when memory was measured
in kilobytes and the ethernet was 10 mgb, so things have changed a bit, and
its effectivness is questionable :-)

danny





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1LBAeU-00086X-I3>