Commit b295bc4c authored by Vitaly Lipatov's avatar Vitaly Lipatov

add rewrite_if_changed, improve /etc/hosts

parent 4cea82c7
......@@ -20,20 +20,41 @@ assure $NAME
assure $AUSER
assure $ACONF
# copied from nginx-etersoft's apache2 generating
# new file -> old file
rewrite_if_changed()
{
local NEWFILE="$1" OLDFILE="$2"
if [ -r $OLDFILE ] ; then
if diff -u $OLDFILE $NEWFILE ; then
echo "$OLDFILE not changed"
rm -f $NEWFILE
return 1
fi
fi
mv -f $NEWFILE $OLDFILE
}
tune_hosts()
{
if ! grep -q "Azbyka's hosts" /etc/hosts ; then
cat <<EOF >>/etc/hosts
cat <<EOF >>/etc/hosts.tmpCB
# Azbyka's hosts
192.168.3.188 memcached.azbyka
192.168.3.185 sphinx.azbyka
192.168.3.186 redis.azbyka
192.168.3.191 mysql.azbyka
192.168.3.191 mysql
192.168.3.191 mysql.$AUSER
192.168.3.190 mariadb.azbyka
192.168.3.190 mariadb
192.168.3.190 mariadb.$AUSER
EOF
fi
rewrite_if_changed /etc/hosts.tmpCB /etc/hosts && update_chrooted_conf
}
tune_logrotate()
{
cat <<EOF >>/etc/logrotate.d/apache-home-local
......
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