diff options
author | mtm <mtm@FreeBSD.org> | 2004-02-03 12:59:30 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2004-02-03 12:59:30 +0000 |
commit | 5be81e2dd96ba7f5594f279a695130c40a706584 (patch) | |
tree | 1742a8d53d25bc5be3adbde4222b54bf50224075 /etc/rc.d/jail | |
parent | 8631fde2dc94ae51ca323b55b6abf9edfb832fd4 (diff) | |
download | FreeBSD-src-5be81e2dd96ba7f5594f279a695130c40a706584.zip FreeBSD-src-5be81e2dd96ba7f5594f279a695130c40a706584.tar.gz |
o Unbreak the individual jail starting patch that I broke when
I committed it. Apologies to Juergen Unger <j.unger@addict.de>.
o When stopping jails output the hostname of the jails that
were stopped.
o Refactor
o Remove extraneous empty line
o Correct spelling error
Diffstat (limited to 'etc/rc.d/jail')
-rw-r--r-- | etc/rc.d/jail | 60 |
1 files changed, 32 insertions, 28 deletions
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" |