Commits

Zhang Huangbin committed c82321d

Rotate Dovecot log files on OpenBSD.

Comments (0)

Files changed (2)

iRedMail/ChangeLog

 iRedMail-0.8.2:
+    * Rotate Dovecot log files on OpenBSD.
     * Allow to use attribute domainGlobalAdmin for mail user.
     * Fixed:
         + Incorrect log rotate setting of iRedAPD log file on FreeBSD.

iRedMail/functions/dovecot2.sh

 
 EOF
 
+    ECHO_DEBUG "Setting logrotate for dovecot log file."
     if [ X"${KERNEL_NAME}" == X'LINUX' ]; then
-        ECHO_DEBUG "Setting logrotate for dovecot log file."
         cat > ${DOVECOT_LOGROTATE_FILE} <<EOF
 ${CONF_MSG}
 ${DOVECOT_LOG_FILE} {
     endscript
 }
 EOF
-    else
-        :
+    elif [ X"${KERNEL_NAME}" == X'OPENBSD' ]; then
+        if ! grep "${DOVECOT_LOG_FILE}" /etc/newsyslog.conf &>/dev/null; then
+            # Define command used to reopen log service after rotated
+            cat >> /etc/newsyslog.conf <<EOF
+${DOVECOT_LOG_FILE}    ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME}   600  7     *    24    Z "doveadm log reopen"
+EOF
+        fi
+
+        if ! grep "${SIEVE_LOG_FILE}" /etc/newsyslog.conf &>/dev/null; then
+            # Define command used to reopen log service after rotated
+            cat >> /etc/newsyslog.conf <<EOF
+${SIEVE_LOG_FILE}    ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME}   600  7     *    24    Z "doveadm log reopen"
+EOF
+        fi
     fi
 
     cat >> ${TIP_FILE} <<EOF