Re: Clogged pipe?
- Reply: Christian Weisgerber : "Re: Clogged pipe?"
- In reply to: Pete : "Re: Clogged pipe?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 06 Apr 2023 14:26:04 UTC
On Tue, Apr 04, 2023 at 12:25:36AM -0700, Pete wrote: > Matthias Apitz wrote on 4/3/23 22:36: > > Well, I was just showing a simplified example to illustrate the problem; > what I was really trying to script is this: > > /usr/bin/tail -f -n+1 /var/log/exim/main-$(/bin/date -u '+%Y%m%d').log | > /bin/cat -n | > /usr/bin/sed -Eu 's/^[[:blank:]]*([[:digit:]]*)[[:blank:]]+/\1 /' > > which prefixes line numbers as it watches today's exim log file scroll > along. So, in this case the -f flag is needed on the tail command. > > What actually fixes the buffering problem on FreeBSD (it already works fine > on Linux) is to add the -u flag to the cat command. > > Jan Schaumann had a great blog post on pipes buffer sizes a while back that may be interesting: https://www.netmeister.org/blog/ipcbufs.html It dives into the internals and does a pretty great break down of how various OS's handle buffering. -pete -- Pete Wright pete@nomadlogic.org