Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Apr 2004 12:13:06 -0400
From:      Alex Vasylenko <lxv@omut.org>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        current@freebsd.org
Subject:   Re: Why the 30-second pause after executing this script?
Message-ID:  <407C1192.2020407@omut.org>
In-Reply-To: <20040413105128.GA35957@stack.nl>
References:  <87wu4pnxs0.fsf__29819.4997165867$1081558708@strauser.com> <407B0462.9040405@omut.org> <20040413105128.GA35957@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?407C1192.2020407>