| cae32 ( @ 2009-05-06 12:12:00 |
Напейсал рестартилку для jail:
Как-то так...
#!/bin/sh
#
# Copyright (C) 2009 Sergey A.Eremenko (eremenko.s@gmail.com)
#
# Written for Eugene Gladchenko's eazy and improving FreeBSD jail hosting
# Please contact thru hosting@gladchenko.ru
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: v1.2 $
# SYNOPSIS
# $ sudo crontab -u root -e
# add line
# */5 * * * * /usr/local/bin/ezjail_check_reboot
#
# DESCRIPTION
# Check for .need_ezjail_restart magic file in root directory of jail and
# restart this machine, remove magic file after restart (no check result)
if [ `id -u` != 0 ] ; then
echo "You must be a root!"
exit 2
fi
ezjail_prefix=/usr/local
ezjail_config_dir="${ezjail_prefix}/etc/ezjail/"
ezjail_restart_script=/usr/local/etc/rc.d/ezjail.sh
ezjail_magic_flag_for_restart=.need_ezjail_restart
ezjail_framework_log="/var/log/ezjail_framework.log"
. /etc/rc.subr
name=ezjail_check_reboot
rcvar=`set_rcvar`
load_rc_config ${name}
ezjail_enable=${ezjail_enable:-"NO"}
if ! checkyesno ezjail_enable; then
return 0
fi
unset ezjail_list ezjail_pass ezjail_restart_files_for_rm
[ -d "${ezjail_config_dir}" ] && cd "${ezjail_config_dir}" && ezjail_list=`ls | xargs rcorder`
for ezjail in ${ezjail_list} ; do
[ -f "${ezjail_config_dir}${ezjail}.norun" -o "${ezjail%.*}" != "${ezjail}" ] && continue
[ ! -r "${ezjail_config_dir}${ezjail}" ] && continue
. "${ezjail_config_dir}${ezjail}"
eval ezjail_rootdir=\"\$jail_${ezjail}_rootdir\"
[ ! -d "${ezjail_rootdir}" ] && continue
[ ! -f "${ezjail_rootdir}/${ezjail_magic_flag_for_restart}" ] && continue
ezjail_pass="${ezjail_pass:} ${ezjail}"
ezjail_restart_files_for_rm="${ezjail_restart_files_for_rm} ${ezjail_rootdir}/${ezjail_magic_flag_for_restart}"
done
[ "${ezjail_pass}" ] && "${ezjail_restart_script}" restart ${ezjail_pass} | while read s ; do
echo "`date +"%b %e %H:%M:%S %Z"` `hostname -s` `basename $0`[$$]" $s >> "${ezjail_framework_log}"
done
[ "${ezjail_restart_files_for_rm}" ] && rm -f ${ezjail_restart_files_for_rm}
Как-то так...