diff --git a/Dockerfile b/Dockerfile index 926c5a7b..216443e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -119,6 +119,8 @@ RUN echo "0 */6 * * * clamav /usr/bin/freshclam --quiet" > /etc/cron.d/clamav-fr COPY target/dovecot/auth-passwdfile.inc target/dovecot/??-*.conf /etc/dovecot/conf.d/ COPY target/dovecot/scripts/quota-warning.sh /usr/local/bin/quota-warning.sh COPY target/dovecot/sieve/ /etc/dovecot/sieve/ +COPY target/dovecot/dovecot-purge.cron /etc/cron.d/dovecot-purge.disabled +RUN chmod 0 /etc/cron.d/dovecot-purge.disabled WORKDIR /usr/share/dovecot # hadolint ignore=SC2016,SC2086 RUN sed -i -e 's/include_try \/usr\/share\/dovecot\/protocols\.d/include_try \/etc\/dovecot\/protocols\.d/g' /etc/dovecot/dovecot.conf && \ diff --git a/target/dovecot/dovecot-purge.cron b/target/dovecot/dovecot-purge.cron new file mode 100644 index 00000000..ead11b28 --- /dev/null +++ b/target/dovecot/dovecot-purge.cron @@ -0,0 +1,5 @@ +# +# Dovecot purge maintenance +# +# m h dom mon dow user command +38 2 * * * root doveadm purge -A diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 9cb951b0..009cc574 100755 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -543,9 +543,13 @@ function _setup_dovecot # set mail_location according to mailbox format case "${DOVECOT_MAILBOX_FORMAT}" in - sdbox|mdbox|maildir ) + sdbox|mdbox ) _notify 'inf' "Dovecot ${DOVECOT_MAILBOX_FORMAT} format configured" sed -i -e 's/^mail_location = .*$/mail_location = '"${DOVECOT_MAILBOX_FORMAT}"':\/var\/mail\/%d\/%n/g' /etc/dovecot/conf.d/10-mail.conf + + _notify 'inf' "Enabling cron job for dbox purge" + mv /etc/cron.d/dovecot-purge.disabled /etc/cron.d/dovecot-purge + chmod 644 /etc/cron.d/dovecot-purge ;; * ) _notify 'inf' "Dovecot maildir format configured (default)"