Commits

Zhang Huangbin  committed 481957c

Add logrotate config file for iRedAPD.

  • Participants
  • Parent commits 2cad5f3

Comments (0)

Files changed (4)

File iRedMail/conf/iredapd

 
 export IREDAPD_LISTEN_ADDR='127.0.0.1'
 export IREDAPD_LISTEN_PORT='7777'
+
+export IREDAPD_LOG_FILE='/var/log/iredapd.log'
+export IREDAPD_LOGROTATE_FILE="${LOGROTATE_DIR}/iredapd"

File iRedMail/functions/dovecot1.sh

 # Use dovecot deliver program as LDA.
 dovecot unix    -       n       n       -       -      pipe
     flags=DRhu user=${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} argv=${DOVECOT_DELIVER} -f \${sender} -d \${user}@\${domain} -m \${extension}
+
 EOF
 
     if [ X"${KERNEL_NAME}" == X'LINUX' ]; then

File iRedMail/functions/dovecot2.sh

 # Use dovecot deliver program as LDA.
 dovecot unix    -       n       n       -       -      pipe
     flags=DRhu user=${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} argv=${DOVECOT_DELIVER} -f \${sender} -d \${user}@\${domain} -m \${extension}
+
 EOF
 
     if [ X"${KERNEL_NAME}" == X'LINUX' ]; then

File iRedMail/functions/iredapd.sh

     # FreeBSD: Start iredapd when system start up.
     freebsd_enable_service_in_rc_conf 'iredapd_enable' 'YES'
 
+    if [ X"${KERNEL_NAME}" == X'LINUX' ]; then
+        ECHO_DEBUG "Setting logrotate for iRedAPD log file."
+        cat > ${IREDAPD_LOGROTATE_FILE} <<EOF
+${CONF_MSG}
+${IREDAPD_LOG_FILE} {
+    compress
+    weekly
+    rotate 10
+    create 0600 ${SYS_ROOT_USER} ${SYS_ROOT_GROUP}
+    missingok
+
+    # Use bzip2 for compress.
+    compresscmd $(which bzip2)
+    uncompresscmd $(which bunzip2)
+    compressoptions -9
+    compressext .bz2
+
+    postrotate
+        ${SYSLOG_POSTROTATE_CMD}
+    endscript
+}
+EOF
+    fi
+
     cat >> ${TIP_FILE} <<EOF
 iRedAPD - Postfix Policy Daemon:
     * Version: ${IREDAPD_VERSION}