Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Apr 2004 07:25:35 -0500
From:      Kirk Strauser <kirk@strauser.com>
To:        freebsd-questions@freebsd.org
Subject:   Why the 30-second pause after executing this script?
Message-ID:  <87wu4pnxs0.fsf@strauser.com>

next in thread | raw e-mail | index | archive | help
--=-=-=
Content-Transfer-Encoding: quoted-printable

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@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@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?
=2D-=20
Kirk Strauser

"94 outdated ports on the box,
 94 outdated ports.
 Portupgrade one, an hour 'til done,
 82 outdated ports on the box."

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBAdpZE5sRg+Y0CpvERAoswAJ9nDb9R7FFeRHmSh7ZP1oS9JIGWTQCfV6Ot
sY+xJEbK9Oa13GqcZfWjzn8=
=NvpU
-----END PGP SIGNATURE-----
--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87wu4pnxs0.fsf>