[Dovecot] automated mailbox trimming?
Hello all,
If this is answered in the wiki, I apologize. Please point me to it and I'll be on my way ...
This may be more of a MailDir-generic question, except that as I understand it there's some wiggle room in the naming of the message files.
I've just switched from an mbox-based mail system to Dovecot with MailDir. With mbox, I used logrotate to keep some of my mailboxes (spam, sent, stuff like that) down to only the most recent messages.
What's the best way to go about mailbox trimming with dovecot's implementation of maildir? I was thinking of writing a script to simply move or delete old files, but would I mess up dovecot's expectations for directory/file structure that way?
My mail directories are in my user's home directory.
I'm fine with writing a script or application (time permitting, of course), but before I do so, is there already a solution out there?
In case it's relevant:
$ dovecot --version 1.2.15 $ dovecot -n # 1.2.15: /etc/dovecot/dovecot.conf # OS: Linux 2.6.37 x86_64 Debian 6.0 log_timestamp: %Y-%m-%d %H:%M:%S ssl: required login_dir: /var/run/dovecot/login login_executable: /usr/lib/dovecot/imap-login mail_privileged_group: mail mbox_write_locks: fcntl dotlock auth default: passdb: driver: passwd-file args: /etc/dovecot/passwords userdb: driver: passwd userdb: driver: passwd-file args: /etc/dovecot/passwords
On 1.2.2011, at 3.00, Monique Y. Mudama wrote:
I've just switched from an mbox-based mail system to Dovecot with MailDir. With mbox, I used logrotate to keep some of my mailboxes (spam, sent, stuff like that) down to only the most recent messages.
What's the best way to go about mailbox trimming with dovecot's implementation of maildir?
http://wiki.dovecot.org/Plugins/Expire although it's a bit annoyingly complex with v1.x. I'm guessing you don't have all that many users, so v2.0 would make this simpler.
I was thinking of writing a script to simply move or delete old files, but would I mess up dovecot's expectations for directory/file structure that way?
There's "v1.0 cronjob equivalent" in the wiki page too. It'll work fine, no messing up Dovecot.
On Tue, Feb 1 at 3:07, Timo Sirainen penned:
What's the best way to go about mailbox trimming with dovecot's implementation of maildir?
http://wiki.dovecot.org/Plugins/Expire although it's a bit annoyingly complex with v1.x. I'm guessing you don't have all that many users, so v2.0 would make this simpler.
I was thinking of writing a script to simply move or delete old files, but would I mess up dovecot's expectations for directory/file structure that way?
There's "v1.0 cronjob equivalent" in the wiki page too. It'll work fine, no messing up Dovecot.
Thank you. You're correct about "all that many users" - with a whopping two users, the cronjob looks good to me =)
:2011-01-31T20:10:Monique Y. Mudama:
On Tue, Feb 1 at 3:07, Timo Sirainen penned:
What's the best way to go about mailbox trimming with dovecot's implementation of maildir?
http://wiki.dovecot.org/Plugins/Expire although it's a bit annoyingly complex with v1.x. I'm guessing you don't have all that many users, so v2.0 would make this simpler.
I was thinking of writing a script to simply move or delete old files, but would I mess up dovecot's expectations for directory/file structure that way?
There's "v1.0 cronjob equivalent" in the wiki page too. It'll work fine, no messing up Dovecot.
Thank you. You're correct about "all that many users" - with a whopping two users, the cronjob looks good to me =)
I have my own approach and just thought I give it here in case anyone is interested.
http://codemages.net/archive_mail-1.0.tar.bz2
Contains: archive_mail.sh - the core script moveme - support script for final movement - used to do some hash checking etc... but now it's a cp && rm archmail.sh - the script I use to run archive_mail.sh
What the script does is:
You have INBOX it will each time is run check for any messages based on fs mtime that is older than N days and will store those messages into: .archive.year.month
I run this daily and it helps keep all the mails down to a managable level.
Hopefully it helps someone.
-- Andraž 'ruskie' Levstik Source Mage GNU/Linux Games/Xorg grimoire guru Re-Alpine Coordinator http://sourceforge.net/projects/re-alpine/ Geek/Hacker/Tinker
Be sure brain is in gear before engaging mouth.
participants (4)
-
Andraž 'ruskie' Levstik
-
Monique Y. Mudama
-
Monique Y. Mudama
-
Timo Sirainen