Add purge cron job for dbox

This commit is contained in:
Germain Masse 2020-12-06 19:57:38 +01:00
parent ec290acd1f
commit d400417d0e
3 changed files with 12 additions and 1 deletions

View file

@ -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/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/scripts/quota-warning.sh /usr/local/bin/quota-warning.sh
COPY target/dovecot/sieve/ /etc/dovecot/sieve/ 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 WORKDIR /usr/share/dovecot
# hadolint ignore=SC2016,SC2086 # 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 && \ RUN sed -i -e 's/include_try \/usr\/share\/dovecot\/protocols\.d/include_try \/etc\/dovecot\/protocols\.d/g' /etc/dovecot/dovecot.conf && \

View file

@ -0,0 +1,5 @@
#
# Dovecot purge maintenance
#
# m h dom mon dow user command
38 2 * * * root doveadm purge -A

View file

@ -543,9 +543,13 @@ function _setup_dovecot
# set mail_location according to mailbox format # set mail_location according to mailbox format
case "${DOVECOT_MAILBOX_FORMAT}" in case "${DOVECOT_MAILBOX_FORMAT}" in
sdbox|mdbox|maildir ) sdbox|mdbox )
_notify 'inf' "Dovecot ${DOVECOT_MAILBOX_FORMAT} format configured" _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 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)" _notify 'inf' "Dovecot maildir format configured (default)"