From 5be81e2dd96ba7f5594f279a695130c40a706584 Mon Sep 17 00:00:00 2001 From: mtm Date: Tue, 3 Feb 2004 12:59:30 +0000 Subject: o Unbreak the individual jail starting patch that I broke when I committed it. Apologies to Juergen Unger . o When stopping jails output the hostname of the jails that were stopped. o Refactor o Remove extraneous empty line o Correct spelling error --- etc/rc.d/jail | 60 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 28 deletions(-) (limited to 'etc') diff --git a/etc/rc.d/jail b/etc/rc.d/jail index efbf856..33072ea 100644 --- a/etc/rc.d/jail +++ b/etc/rc.d/jail @@ -45,7 +45,7 @@ init_variables() eval jail_procfs=\"\$jail_${_j}_procfs_enable\" [ -z "${jail_procfs}" ] && jail_procfs="NO" - # Debuggin aid + # Debugging aid # debug "$_j devfs enable: $jail_devfs" debug "$_j fdescfs enable: $jail_fdescfs" @@ -86,6 +86,30 @@ set_sysctl() fi } +# jail_umount_fs +# This function unmounts certain special filesystems in the +# currently selected jail. The caller must call the init_variables() +# routine before calling this one. +# +jail_umount_fs() +{ + if checkyesno jail_fdescfs; then + if [ -d ${jail_fdescdir} ] ; then + umount -f ${jail_fdescdir} >/dev/null 2>&1 + fi + fi + if checkyesno jail_devfs; then + if [ -d ${jail_devdir} ] ; then + umount -f ${jail_devdir} >/dev/null 2>&1 + fi + fi + if checkyesno jail_procfs; then + if [ -d ${jail_procdir} ] ; then + umount -f ${jail_procdir} >/dev/null 2>&1 + fi + fi +} + jail_start() { echo -n 'Configuring jails:' @@ -145,45 +169,25 @@ jail_start() jail_stop() { - echo 'Stopping jails.' + echo -n 'Stopping jails:' for _jail in ${jail_list} do if [ -f /var/run/jail_${_jail}.id ]; then _jail_id=$(cat /var/run/jail_${_jail}.id) if [ ! -z ${_jail_id} ]; then + init_variables $_jail killall -j ${_jail_id} -TERM > /dev/null 2>&1 + jail_umount_fs + echo -n " $jail_hostname" fi rm /var/run/jail_${_jail}.id else - echo "cannot stop jail ${_jail}. no jail id saved in /var/run" - jail_list=$(echo ${jail_list} | \ - tr ' ' '\n' | \ - grep -v "^${_jail}$" | \ - tr '\n' ' ') - fi - done - for _jail in ${jail_list} - do - init_variables $_jail - if checkyesno jail_fdescfs; then - if [ -d ${jail_fdescdir} ] ; then - umount -f ${jail_fdescdir} >/dev/null 2>&1 - fi - fi - if checkyesno jail_devfs; then - if [ -d ${jail_devdir} ] ; then - umount -f ${jail_devdir} >/dev/null 2>&1 - fi - fi - if checkyesno jail_procfs; then - if [ -d ${jail_procdir} ] ; then - umount -f ${jail_procdir} >/dev/null 2>&1 - fi + echo "cannot stop jail ${_jail}. No jail id in /var/run" fi done + echo '.' } - -[ -n "$2" ] && jail_list="$2" load_rc_config $name +[ -n "$2" ] && jail_list="$2" run_rc_command "$1" -- cgit v1.1