From 6de449ff2895c123cbdd2ed0b5147fd38d48813a Mon Sep 17 00:00:00 2001 From: yohan <783b8c87@scimetis.net> Date: Sun, 14 Apr 2019 18:44:54 +0200 Subject: [PATCH] Initial commit. --- .gitignore | 1 + crontab | 11 +++++++++++ docker-compose.yml | 44 ++++++++++++++++++++++++++++++++++++++++++++ dovecot_expire.sh | 22 ++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 .gitignore create mode 100644 crontab create mode 100644 docker-compose.yml create mode 100755 dovecot_expire.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a901d66 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +private_README diff --git a/crontab b/crontab new file mode 100644 index 0000000..c6fb210 --- /dev/null +++ b/crontab @@ -0,0 +1,11 @@ +# /etc/crontab: system-wide crontab +# Unlike any other crontab you don't have to run the `crontab' +# command to install the new version when you edit this file +# and files in /etc/cron.d. These files also have username fields, +# that none of the other crontabs do. + +SHELL=/bin/sh +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +# m | h | day of month | month | day of week | user | command +30 0 * * * root docker -H tcp://127.0.0.1:2375 exec dockermailstack_dovecot_1 /root/dovecot_expire.sh > /proc/1/fd/2 2>&1 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3de61ae --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,44 @@ +version: "2.1" + +services: + + dovecot: + image: dovecot + restart: always + ports: + - 993:993/tcp + - 4190:4190/tcp + networks: + - mailnet + volumes: + - mail_data:/home/yohan + - ./dovecot_expire.sh:/root/dovecot_expire.sh + + fetchmail: + image: fetchmail + restart: always + networks: + - mailnet + + feed2imap: + image: feed2imap + restart: always + networks: + - mailnet + + cron-purge-dovecot: + image: cron + restart: always + network_mode: "host" + volumes: + - ./crontab:/etc/crontab + +networks: + + mailnet: + external: true + +volumes: + + mail_data: + external: true diff --git a/dovecot_expire.sh b/dovecot_expire.sh new file mode 100755 index 0000000..2c47f51 --- /dev/null +++ b/dovecot_expire.sh @@ -0,0 +1,22 @@ +#!/bin/bash +doveadm expunge -u admin mailbox Feeds.phoronix savedbefore 60d +doveadm expunge -u admin mailbox Feeds.hardwarefr savedbefore 60d +doveadm expunge -u admin mailbox Feeds.pcinpact_articles savedbefore 60d +doveadm expunge -u admin mailbox Feeds.planet_debian savedbefore 60d +doveadm expunge -u admin mailbox Feeds.planet-fr_debian_net savedbefore 60d +doveadm expunge -u admin mailbox Feeds.planetkde savedbefore 60d +doveadm expunge -u admin mailbox Feeds.le_monde savedbefore 60d +doveadm expunge -u admin mailbox Feeds.hardwarefr_articles savedbefore 60d +doveadm expunge -u admin mailbox Feeds.lesnumeriques savedbefore 60d +doveadm expunge -u admin mailbox Feeds.planet_libre savedbefore 60d +doveadm expunge -u admin mailbox Feeds.fedora-fr savedbefore 60d +doveadm expunge -u admin mailbox Feeds.pcinpact savedbefore 60d +doveadm expunge -u admin mailbox Feeds.dotkdeorg savedbefore 60d +doveadm expunge -u admin mailbox Feeds.reddit_science savedbefore 60d +doveadm expunge -u admin mailbox Feeds.reddit_technology savedbefore 60d +doveadm expunge -u admin mailbox Feeds.ars_technica savedbefore 60d +doveadm expunge -u admin mailbox Feeds.cinema_france savedbefore 60d +doveadm expunge -u admin mailbox Feeds.cinema_usa savedbefore 60d +echo `date +"%F %T"` "Old feeds purged" +exit 0 +