Why the 30-second pause after executing this script?

Kirk Strauser kirk at strauser.com
Fri Apr 9 05:25:42 PDT 2004


One of my programs (plug: JailAdmin!  Stays crunchy in milk!) uses 'jexec'
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:

  The command dumping to STDOUT:

    root at kanga:/tmp# time jexec 8 sh -x /etc/rc.shutdown
    + stty status ^T
    + trap : 2
    + trap : 3

    ...

    + kill -TERM 80521
    Terminated
    + echo .
    .
    + exit 0

    real    0m0.575s
    user    0m0.043s
    sys     0m0.195s

  The command dumping to a pipe:

    root at kanga:/tmp# time jexec 8 sh -x /etc/rc.shutdown | cat
    + stty status ^T
    + trap : 2
    + trap : 3

    ...

    + kill -TERM 80638
    Terminated
    + echo .
    .
    + exit 0

    real    0m30.049s
    user    0m0.070s
    sys     0m0.162s

I'm at a loss.  Why would this be?  Are there workarounds?
-- 
Kirk Strauser

"94 outdated ports on the box,
 94 outdated ports.
 Portupgrade one, an hour 'til done,
 82 outdated ports on the box."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040409/68ef0a1e/attachment.bin


More information about the freebsd-questions mailing list