aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Riondato <matteo@FreeBSD.org>2006-05-09 17:50:16 +0000
committerMatteo Riondato <matteo@FreeBSD.org>2006-05-09 17:50:16 +0000
commit8cf29c0839d1727765d331acacbe576954b38c52 (patch)
tree708e308804c58da89473e332967a51c244444289
parentb42bfe19478e6769f471025b7381e00235445b99 (diff)
downloadsrc-8cf29c0839d1727765d331acacbe576954b38c52.tar.gz
src-8cf29c0839d1727765d331acacbe576954b38c52.zip
if a jail fails to start, don't add its jid to /var/run and print a message with the error.
PR: conf/97024 MFC after: 1 week
Notes
Notes: svn path=/head/; revision=158379
-rw-r--r--etc/rc.d/jail15
1 files changed, 10 insertions, 5 deletions
diff --git a/etc/rc.d/jail b/etc/rc.d/jail
index 8b9f3841aef4..3b4a4a51a1d5 100644
--- a/etc/rc.d/jail
+++ b/etc/rc.d/jail
@@ -221,11 +221,16 @@ jail_start()
_tmp_jail=${_tmp_dir}/jail.$$
eval jail ${jail_flags} -i ${jail_rootdir} ${jail_hostname} \
${jail_ip} ${jail_exec_start} > ${_tmp_jail} 2>&1
- [ "$?" -eq 0 ] && echo -n " $jail_hostname"
- _jail_id=$(head -1 ${_tmp_jail})
- tail +2 ${_tmp_jail} >${jail_rootdir}/var/log/console.log
+ if [ "$?" -eq 0 ] ; then
+ echo -n " $jail_hostname"
+ _jail_id=$(head -1 ${_tmp_jail})
+ tail +2 ${_tmp_jail} >${jail_rootdir}/var/log/console.log
+ echo ${_jail_id} > /var/run/jail_${_jail}.id
+ else
+ echo " cannot start jail \"${_jail}\": "
+ tail +2 ${_tmp_jail}
+ fi
rm -f ${_tmp_jail}
- echo ${_jail_id} > /var/run/jail_${_jail}.id
done
rmdir ${_tmp_dir}
echo '.'
@@ -255,7 +260,7 @@ jail_stop()
fi
rm /var/run/jail_${_jail}.id
else
- echo "cannot stop jail ${_jail}. No jail id in /var/run"
+ echo " cannot stop jail ${_jail}. No jail id in /var/run"
fi
done
echo '.'