diff options
author | matteo <matteo@FreeBSD.org> | 2006-05-09 17:50:16 +0000 |
---|---|---|
committer | matteo <matteo@FreeBSD.org> | 2006-05-09 17:50:16 +0000 |
commit | 0aae2a2db41b2958ad221c5cfb4221c1d64c8785 (patch) | |
tree | 708e308804c58da89473e332967a51c244444289 /etc/rc.d/jail | |
parent | bba2409d42da10f074e5f194de71ab07f590be4d (diff) | |
download | FreeBSD-src-0aae2a2db41b2958ad221c5cfb4221c1d64c8785.zip FreeBSD-src-0aae2a2db41b2958ad221c5cfb4221c1d64c8785.tar.gz |
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
Diffstat (limited to 'etc/rc.d/jail')
-rw-r--r-- | etc/rc.d/jail | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/etc/rc.d/jail b/etc/rc.d/jail index 8b9f384..3b4a4a5 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 '.' |