From owner-freebsd-current@FreeBSD.ORG Tue Apr 13 09:13:18 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B51116A4CE for ; Tue, 13 Apr 2004 09:13:18 -0700 (PDT) Received: from mail.omut.org (mail.omut.org [216.218.215.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id D889B43D1D for ; Tue, 13 Apr 2004 09:13:17 -0700 (PDT) (envelope-from lxv@omut.org) Received: from omut.org (bullfrog.intranet [10.10.10.26]) (authenticated bits=0) by mail.omut.org (8.12.11/8.12.11) with ESMTP id i3DGD8pO035797 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Apr 2004 09:13:15 -0700 (PDT) (envelope-from lxv@omut.org) Message-ID: <407C1192.2020407@omut.org> Date: Tue, 13 Apr 2004 12:13:06 -0400 From: Alex Vasylenko User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jilles Tjoelker References: <87wu4pnxs0.fsf__29819.4997165867$1081558708@strauser.com> <407B0462.9040405@omut.org> <20040413105128.GA35957@stack.nl> In-Reply-To: <20040413105128.GA35957@stack.nl> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.42 cc: Kirk Strauser cc: current@freebsd.org Subject: Re: Why the 30-second pause after executing this script? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Apr 2004 16:13:18 -0000 Jilles Tjoelker wrote: >>>to attach to a jail to execute /etc/rc.shutdown. I've noticed that this >>>works as expected, unless its output is being piped into another program, >>>in >>>which case 'sh' waits about 30 seconds after the 'exit 0' line is executed >>>before closing its end of the pipe. For example: > >>/etc/rc.shutdown kills the _shell_ of the watchdog timer instead of the >>timer itself, so the timer keeps going. Please try the patch attached. >>- sleep $rcshutdown_timeout && ( >>+ exec sleep $rcshutdown_timeout && ( > > > This means that the part after && is never executed, invalidating the > whole purpose of the watchdog! oops! you're correct, of course. > Another option is to close the stdin/stdout/stderr in the watchdog (this > doesn't seem very satisfying though): [...] > - sleep $rcshutdown_timeout && ( > + exec 0<>/dev/tty 1>&0 2>&1 && sleep $rcshutdown_timeout && ( here's a simple fix that appears to work: - sleep $rcshutdown_timeout && ( + sleep $rcshutdown_timeout >&- && ( -- Alex.