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
This commit is contained in:
mtm 2004-02-03 12:59:30 +00:00
parent 99b1644418
commit 29b6073150

View File

@ -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"