install_roundcube.sh: fix error creating logrotae definitions.

This commit is contained in:
Christoph 2019-11-15 14:36:04 +01:00
parent 7775ae21c6
commit 0885824946

View File

@ -186,6 +186,7 @@ DEFAULT_MYSQL_CREDENTIALS="--defaults-file=/usr/local/mysql/sys-maint.cnf"
TLD=${WEBSITE_NAME##*.}
_tmp_string=${WEBSITE_NAME%.*}
MAIN_DOMAIN=${_tmp_string##*.}
HOSTNAME_SHORT=${_tmp_string%%.*}
[[ -n "$WEBMASTER_EMAIL" ]] || WEBMASTER_EMAIL="admin@${MAIN_DOMAIN}.$TLD"
@ -1540,11 +1541,7 @@ fi
# - Logrotate logfiles from webmailer, locatet at $WEBSITE_BASEDIR/logs
# -
echononl "\tCreate logrotate entry.."
if [[ "$PHP_TYPE" = "fcgid" ]] ; then
cat <<EOF > /etc/logrotate.d/roundcube 2> $log_file
$WEBSITE_BASEDIR/logs/errors
$WEBSITE_BASEDIR/logs/sql
$WEBSITE_BASEDIR/logs/sendmail
cat <<EOF > /etc/logrotate.d/roundcube-${HOSTNAME_SHORT} 2> $log_file
$WEBSITE_BASEDIR/logs/*.log {
daily
start 0
@ -1555,36 +1552,20 @@ $WEBSITE_BASEDIR/logs/*.log {
delaycompress
create 640 www-data www-data
copytruncate
postrotate
# Maybe apache2 logrotating sets wron file permissions..
#
if ls /var/www/${WEBSITE_BASEDIR}/logs/*.log > /dev/null 2>&1 ; then
chown www-data:www-data /var/www/${WEBSITE_BASEDIR}/logs/*.log
fi
endscript
}
EOF
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
elif [[ "$APACHE_LOG_DIR" =~ ${WEBSITE_BASEDIR} ]] ; then
cat <<EOF > /etc/logrotate.d/roundcube 2> $log_file
$APACHE_LOG_DIR/*.log {
daily
start 0
rotate 7
missingok
notifempty
compress
delaycompress
create 640 www-data www-data
copytruncate
}
EOF
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_failed
error "$(cat $log_file)"
fi
if [[ $? -eq 0 ]]; then
echo_ok
else
echo_skipped
echo_failed
error "$(cat $log_file)"
fi