Re: Why the 30-second pause after executing this script?

From: Alex Vasylenko <lxv_at_omut.org>
Date: Tue, 13 Apr 2004 12:13:06 -0400
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.
Received on Tue Apr 13 2004 - 07:13:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:50 UTC