Date: Thu, 20 Dec 2007 10:48:40 -0800 From: Chuck Swiger <cswiger@mac.com> To: Mikhail Teterin <mi+kde@aldan.algebra.com> Cc: questions@freebsd.org, "Max N. Boyarov" <m.boyarov@bsd.by> Subject: Re: tail does not exit Message-ID: <7A58A4F6-4F31-4972-8213-4B9406D6A3FF@mac.com> In-Reply-To: <200712200458.27988@aldan> References: <200712192322.lBJNMfps053071@aldan.algebra.com> <200712191906.16254.mi%2Bmill@aldan.algebra.com> <86r6hixiyn.fsf@bsd.by> <200712200458.27988@aldan>
next in thread | previous in thread | raw e-mail | index | archive | help
On Dec 20, 2007, at 1:58 AM, Mikhail Teterin wrote: > On =D1=81=D0=B5=D1=80=D0=B5=D0=B4=D0=B0 19 =D0=B3=D1=80=D1=83=D0=B4=D0=B5= =D0=BD=D1=8C 2007, Chuck Swiger wrote: > =3D A quick test suggests that "tail -f" will close when it gets a =20 > SIGPIPE. > > SIGPIPE? How is that relevant? Does tail get a SIGPIPE, when awk =20 > disappears > in my example? If it does not, why do you bring it up? tail should get a SIGPIPE when it tries to write to a pipeline where =20 the other end has closed. > And if it does get SIGPIPE, then you are wrong, because the posted > "quick test" shows the exact opposite behavior -- tail does NOT go > away. > > Please, clarify... Thanks. Worked for me. I opened two SSH sessions to a FreeBSD 5.5 system, and =20= did this in one: % touch /tmp/logfile % echo "line 1" >> /tmp/logfile ...and this in the other: % tail -f /tmp/logfile | awk '{print "Line: " $1 ; exit(0)}END{print =20= "Bye"}' ...when I then did a: % echo "line 2" >> /tmp/logfile ...in the first, the tail -f process terminated in the second. --=20 -Chuck
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7A58A4F6-4F31-4972-8213-4B9406D6A3FF>