From c9ecf24b3e2461e0ea35ddaeb17785237a92ac4b Mon Sep 17 00:00:00 2001 From: missytake Date: Mon, 16 Oct 2023 17:43:58 +0200 Subject: [PATCH] dovecot: expunge seen messages older than 40 days each night --- deploy-chatmail/src/deploy_chatmail/__init__.py | 10 ++++++++++ .../src/deploy_chatmail/dovecot/expunge.cron | 4 ++++ 2 files changed, 14 insertions(+) create mode 100644 deploy-chatmail/src/deploy_chatmail/dovecot/expunge.cron diff --git a/deploy-chatmail/src/deploy_chatmail/__init__.py b/deploy-chatmail/src/deploy_chatmail/__init__.py index 381b3054..5e280fa2 100644 --- a/deploy-chatmail/src/deploy_chatmail/__init__.py +++ b/deploy-chatmail/src/deploy_chatmail/__init__.py @@ -160,6 +160,16 @@ def _configure_dovecot(mail_server: str) -> bool: ) need_restart |= auth_config.changed + files.put( + src=importlib.resources.files(__package__) + .joinpath("dovecot/expunge.cron") + .open("rb"), + dest="/etc/cron.d/expunge", + user="root", + group="root", + mode="644", + ) + return need_restart diff --git a/deploy-chatmail/src/deploy_chatmail/dovecot/expunge.cron b/deploy-chatmail/src/deploy_chatmail/dovecot/expunge.cron new file mode 100644 index 00000000..cd6af52a --- /dev/null +++ b/deploy-chatmail/src/deploy_chatmail/dovecot/expunge.cron @@ -0,0 +1,4 @@ +2 0 * * * dovecot doveadm expunge -A SEEN BEFORE 40d INBOX +2 0 * * * dovecot doveadm expunge -A SEEN BEFORE 40d Deltachat +2 0 * * * dovecot doveadm expunge -A SEEN BEFORE 40d Trash +2 30 * * * dovecot doveadm purge -A \ No newline at end of file