Commit 02f115b3 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add FDOMAIN part, use it in logrotate file

parent da20f325
......@@ -19,6 +19,11 @@ TASK="$1"
assure $NAME
assure $AUSER
assure $ACONF
assure $ADOMAIN
assure $VEID
# Выделяем начальное слово в домене
FDOMAINPART="$(echo "$ADOMAIN" | sed -e "s|\..*||")"
# TODO: external config
ADMINEMAIL=lav@etersoft.ru
......@@ -89,7 +94,7 @@ EOF
tune_logrotate()
{
cat <<EOF >/etc/logrotate.d/apache-home-local.tmpCB
/home/*/log/*.log {
/home/$AUSER/log/$FDOMAINPART*.log {
missingok
rotate 3
size 3000k
......@@ -173,14 +178,13 @@ cat <<EOF > /etc/httpd2/conf/mods-available/remoteip.conf
EOF
ln -sr /etc/httpd2/conf/mods-available/remoteip.conf /etc/httpd2/conf/mods-enabled/remoteip.conf
cp /tmp/prepend.php /etc/httpd2/conf/include/prepend.php || fatal
# TODO
if [ -s /tmp/$ACONF.conf ] ; then
cp /tmp/$ACONF.conf /etc/httpd2/conf/sites-enabled/$ACONF.conf || fatal
cp /tmp/prepend.php /etc/httpd2/conf/include/prepend.php || fatal
subst "s|^NameVirtualHost.*||g" /etc/httpd2/conf/sites-enabled/$ACONF.conf
subst "s|^<VirtualHost.*|<VirtualHost *:80>|g" /etc/httpd2/conf/sites-enabled/$ACONF.conf
#PORT=$(grep "^<VirtualHost" /etc/httpd2/conf/sites-enabled/$AUSER.conf | sed -e "s|<VirtualHost \*:\([0-9]*\)>.*|\1|")
#"
#[ -n "$PORT" ] || fatal
......@@ -213,6 +217,7 @@ EOF
</Location>\n\
\n\
\1|" /etc/httpd2/conf/sites-enabled/$ACONF.conf
fi
if ! grep -q mpm_itk_module /etc/httpd2/conf/extra-available/httpd-mpm.conf ; then
subst "s|\(# worker MPM.*\)|\
......
......@@ -48,7 +48,7 @@ TASK="$1"
# TODO
VEIP=$BASEIP.$VEID
#
# Если не указан системный пользователь AUSER
if [ -z "$AUSER" ] ; then
if [ -n "$BASENAME" ] ; then
AUSER=${BASENAME}_$NAME
......@@ -61,10 +61,12 @@ if [ -z "$AUSER" ] ; then
fi
fi
# Если домен не был явно задан в конфиге, берём из NAME
if [ -z "$ADOMAIN" ] ; then
ADOMAIN="$NAME"
fi
# Если название конфига явно не задано, берём из NAME
if [ -z "$ACONF" ] ; then
ACONF="$NAME"
fi
......@@ -121,8 +123,11 @@ if [ -n "$VEIDORIG" ] ; then
hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/sites-enabled/$ACONF.conf > apache/$ACONF.conf
fi
[ -s apache/$ACONF.conf ] || fatal "Empty apache/$ACONF.conf"
cat apache/$ACONF.conf | st tee /tmp/$ACONF.conf >/dev/null
if [ -s apache/$ACONF.conf ] ; then
cat apache/$ACONF.conf | st tee /tmp/$ACONF.conf >/dev/null
else
echo "Empty apache/$ACONF.conf, skipped"
fi
hostserver cat /var/lib/vz/root/$VEIDORIG/etc/httpd2/conf/include/prepend.php | st tee /tmp/prepend.php >/dev/null
st test -s /tmp/prepend.php || fatal "Empty prepend.php"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment