Add logrotate configuration.

This commit is contained in:
2017-10-18 12:36:21 +02:00
parent 968cba3ef9
commit 9dbc786c44
2 changed files with 80 additions and 1 deletions

View File

@ -57,6 +57,9 @@ echo_ok() {
echo_failed(){
echo -e " [ \033[1;31mfailed\033[m ]"
}
echo_skipped(){
echo -e " [ \033[1;33mskipped\033[m ]"
}
## --------------------------------------------------
@ -563,6 +566,43 @@ elif [ -f /etc/man.conf];then
fi
echo ""
echo -n -e "\tConfigure logrotation.."
if [ ! -f "/etc/logrotate.d/apache2" ]; then
cat <<EOF > /etc/logrotate.d/apache2
/var/log/apache2/*log
/var/log/apache2/*error
/var/www/*/logs/*log
/var/www/*/logs/*error {
daily
missingok
rotate 7
compress
delaycompress
notifempty
create 644 root adm
sharedscripts
postrotate
chown ${HTTPD_USER}:${HTTPD_GROUP} /var/www/*/logs/php_errors.log
chown ${HTTPD_USER}:${HTTPD_GROUP} /var/log/apache2/php_errors.log
APACHECTL="\$(which apachectl)"
if [[ -z "\$APACHECTL" ]] ; then
echo "Prog 'apachectl' not found!"
else
\$APACHECTL graceful > /dev/null
fi
endscript
}
EOF
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
else
echo_skipped
fi
## - Add /usr/local/apache2/bin to the systems PATH variable
## -