From ff6074b088870a22b702e3d27e55a91f895bbb84 Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 18 Oct 2017 14:55:51 +0200 Subject: [PATCH] Change logrotation file. --- install_httpd-2.2.sh | 14 +++++++++++--- install_httpd-2.4.sh | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/install_httpd-2.2.sh b/install_httpd-2.2.sh index de430d3..6a399dc 100755 --- a/install_httpd-2.2.sh +++ b/install_httpd-2.2.sh @@ -583,11 +583,19 @@ if [ ! -f "/etc/logrotate.d/apache2" ]; then 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 + if ls /var/www/*/logs/php_errors.log > /dev/null 2>&1 ; then + chown ${HTTPD_USER}:${HTTPD_GROUP} /var/www/*/logs/php_errors.log + fi + if [[ -f "/var/log/apache2/php_errors.log" ]] ; then + chown ${HTTPD_USER}:${HTTPD_GROUP} /var/log/apache2/php_errors.log + fi APACHECTL="\$(which apachectl)" if [[ -z "\$APACHECTL" ]] ; then - echo "Prog 'apachectl' not found!" + if [[ -f "/etc/init.d/apache2" ]; then + /etc/init.d/apache2 reload > /dev/null + else + echo "Reloading apache service failed!" + fi else \$APACHECTL graceful > /dev/null fi diff --git a/install_httpd-2.4.sh b/install_httpd-2.4.sh index 7b0cd21..37e2faa 100755 --- a/install_httpd-2.4.sh +++ b/install_httpd-2.4.sh @@ -3580,11 +3580,19 @@ if [ ! -f "/etc/logrotate.d/apache2" ]; then 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 + if ls /var/www/*/logs/php_errors.log > /dev/null 2>&1 ; then + chown ${HTTPD_USER}:${HTTPD_GROUP} /var/www/*/logs/php_errors.log + fi + if [[ -f "/var/log/apache2/php_errors.log" ]] ; then + chown ${HTTPD_USER}:${HTTPD_GROUP} /var/log/apache2/php_errors.log + fi APACHECTL="\$(which apachectl)" if [[ -z "\$APACHECTL" ]] ; then - echo "Prog 'apachectl' not found!" + if [[ -f "/etc/init.d/apache2" ]; then + /etc/init.d/apache2 reload > /dev/null + else + echo "Reloading apache service failed!" + fi else \$APACHECTL graceful > /dev/null fi