From owner-freebsd-questions@FreeBSD.ORG Thu Dec 20 18:48:42 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36F9316A418 for ; Thu, 20 Dec 2007 18:48:42 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from mail-out3.apple.com (mail-out3.apple.com [17.254.13.22]) by mx1.freebsd.org (Postfix) with ESMTP id 147A713C467 for ; Thu, 20 Dec 2007 18:48:42 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from relay11.apple.com (relay11.apple.com [17.128.113.48]) by mail-out3.apple.com (Postfix) with ESMTP id 04C141BC88AC; Thu, 20 Dec 2007 10:48:42 -0800 (PST) Received: from relay11.apple.com (unknown [127.0.0.1]) by relay11.apple.com (Symantec Mail Security) with ESMTP id E0BDA28084; Thu, 20 Dec 2007 10:48:41 -0800 (PST) X-AuditID: 11807130-a5e46bb000004fb9-4e-476ab909b430 Received: from cswiger1.apple.com (cswiger1.apple.com [17.214.13.96]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by relay11.apple.com (Apple SCV relay) with ESMTP id 8724E28082; Thu, 20 Dec 2007 10:48:41 -0800 (PST) Message-Id: <7A58A4F6-4F31-4972-8213-4B9406D6A3FF@mac.com> From: Chuck Swiger To: Mikhail Teterin In-Reply-To: <200712200458.27988@aldan> Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v915) Date: Thu, 20 Dec 2007 10:48:40 -0800 References: <200712192322.lBJNMfps053071@aldan.algebra.com> <200712191906.16254.mi+mill@aldan.algebra.com> <86r6hixiyn.fsf@bsd.by> <200712200458.27988@aldan> X-Mailer: Apple Mail (2.915) X-Brightmail-Tracker: AAAAAA== Cc: questions@freebsd.org, "Max N. Boyarov" Subject: Re: tail does not exit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Dec 2007 18:48:42 -0000 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