diff options
author | Renato Botelho <renato@netgate.com> | 2016-07-19 11:28:42 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-07-19 11:28:42 -0300 |
commit | d672f772561b19a87633a38b63c9b6b9ee457a3e (patch) | |
tree | ddb56ff0f93f58cbbbe2e088659df322eeb91960 /etc | |
parent | 0a721af42b1b08f07aac9419590a4906d5b1e8f8 (diff) | |
parent | 9a5d5ad86e4479378293a6598ce3e086d8abf1a8 (diff) | |
download | FreeBSD-src-d672f772561b19a87633a38b63c9b6b9ee457a3e.zip FreeBSD-src-d672f772561b19a87633a38b63c9b6b9ee457a3e.tar.gz |
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/rc.d/jail | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/etc/rc.d/jail b/etc/rc.d/jail index a42e450..51ecf77 100755 --- a/etc/rc.d/jail +++ b/etc/rc.d/jail @@ -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 @@ -451,6 +451,9 @@ jail_start() command=$jail_program rc_flags=$jail_flags command_args="-f $jail_conf -c" + if ! checkyesno jail_parallel_start; then + command_args="$command_args -p1" + fi _tmp=`mktemp -t jail` || exit 3 if $command $rc_flags $command_args >> $_tmp 2>&1; then $jail_jls jid name | while read _id _name; do @@ -458,7 +461,7 @@ jail_start() echo $_id > /var/run/jail_${_name}.id done else - tail -1 $_tmp + cat $_tmp fi rm -f $_tmp echo '.' @@ -470,29 +473,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. @@ -544,7 +548,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command $rc_flags $command_args $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi @@ -567,7 +571,7 @@ jail_stop() _tmp=`mktemp -t jail` || exit 3 $command -q -f $_conf -r $_j >> $_tmp 2>&1 if $jail_jls -j $_j > /dev/null 2>&1; then - tail -1 $_tmp + cat $_tmp else rm -f /var/run/jail_${_j}.id fi |