Date: Sun, 17 Jul 2016 14:05:11 +0000 (UTC) From: Jamie Gritton <jamie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r302953 - stable/11/etc/rc.d Message-ID: <201607171405.u6HE5B4O033470@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jamie Date: Sun Jul 17 14:05:11 2016 New Revision: 302953 URL: https://svnweb.freebsd.org/changeset/base/302953 Log: MFC r302855: Wait for jails to complete startup if jail_parallel_start is YES, instead of assuming they'll take less than one second. PR: 203172 Submitted by: dmitry2004@yandex.ru Approved by: re (gjb) Modified: stable/11/etc/rc.d/jail Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/rc.d/jail ============================================================================== --- stable/11/etc/rc.d/jail Sun Jul 17 13:43:46 2016 (r302952) +++ stable/11/etc/rc.d/jail Sun Jul 17 14:05:11 2016 (r302953) @@ -440,7 +440,7 @@ jail_status() jail_start() { - local _j _jv _jid _jl _id _name + local _j _jv _jid _id _name if [ $# = 0 ]; then return @@ -470,29 +470,30 @@ jail_start() # Start jails in parallel and then check jail id when # jail_parallel_start is YES. # - _jl= for _j in $@; do _j=$(echo $_j | tr /. _) _jv=$(echo -n $_j | tr -c '[:alnum:]' _) parse_options $_j $_jv || continue - _jl="$_jl $_j" eval rc_flags=\${jail_${_jv}_flags:-$jail_flags} eval command=\${jail_${_jv}_program:-$jail_program} command_args="-i -f $_conf -c $_j" - $command $rc_flags $command_args \ - >/dev/null 2>&1 </dev/null & - done - sleep 1 - for _j in $_jl; do - echo -n " ${_hostname:-${_j}}" - if _jid=$($jail_jls -j $_j jid); then - echo "$_jid" > /var/run/jail_${_j}.id - else - echo " cannot start jail " \ - "\"${_hostname:-${_j}}\": " - fi + ( + _tmp=`mktemp -t jail_${_j}` || exit 3 + if $command $rc_flags $command_args \ + >> $_tmp 2>&1 </dev/null; then + echo -n " ${_hostname:-${_j}}" + _jid=$($jail_jls -j $_j jid) + echo $_jid > /var/run/jail_${_j}.id + else + echo " cannot start jail " \ + "\"${_hostname:-${_j}}\": " + cat $_tmp + fi + rm -f $_tmp + ) & done + wait else # # Start jails one-by-one when jail_parallel_start is NO.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607171405.u6HE5B4O033470>