While running dovecot on debian etch using version 1.0.rc15-2etch3, i wonder the following: If i read the config files correctly, dovecot seems to have no equivalent of courier's IMAP_EMPTYTRASH=Trash:7 setting. Therefore, i wrote a script that dives into the user's directories and their maildirs. It looks like this: ============================================#!/bin/bash for pad1 in $(ls /home) do if [ -e "/home/$pad1/Maildir/.Prullenbak" ] then find "/home/$pad1/Maildir/.Prullenbak/cur" -mtime +2 -type f -delete find "/home/$pad1/Maildir/.Prullenbak/new" -mtime +2 -type f -delete fi if [ -e "/home/$pad1/Maildir/.Allerlei.Spam" ] then find "/home/$pad1/Maildir/.Allerlei.Spam/cur" -mtime +2 -type f -delete find "/home/$pad1/Maildir/.Allerlei.Spam/new" -mtime +2 -type f -delete fi done ===========================================Now, can i just put a script like this in /etc/hourly or do i have to add things like stopping the dovecot deamon (i sure hope not!) in order to prevent file-corruption? Or has dovecot in the meantime got a config option that does this just like courier does? Rody
Use mail-expire. On Feb 7, 2008 5:58 PM, Rody <rody at xs4all.nl> wrote:> While running dovecot on debian etch using version 1.0.rc15-2etch3, i > wonder > the following: > > If i read the config files correctly, dovecot seems to have no equivalent > of > courier's IMAP_EMPTYTRASH=Trash:7 setting. > Therefore, i wrote a script that dives into the user's directories and > their > maildirs. It looks like this: > ============================================> #!/bin/bash > > for pad1 in $(ls /home) > do > if [ -e "/home/$pad1/Maildir/.Prullenbak" ] > then find "/home/$pad1/Maildir/.Prullenbak/cur" -mtime +2 -type f > -delete > find "/home/$pad1/Maildir/.Prullenbak/new" -mtime +2 -type f > -delete > fi > if [ -e "/home/$pad1/Maildir/.Allerlei.Spam" ] > then find "/home/$pad1/Maildir/.Allerlei.Spam/cur" -mtime +2 -type > f -delete > find "/home/$pad1/Maildir/.Allerlei.Spam/new" -mtime +2 -type > f -delete > fi > done > ===========================================> Now, can i just put a script like this in /etc/hourly or do i have to add > things like stopping the dovecot deamon (i sure hope not!) in order to > prevent file-corruption? > > Or has dovecot in the meantime got a config option that does this just > like > courier does? > > Rody >
Rody wrote:> While running dovecot on debian etch using version 1.0.rc15-2etch3, i wonder > the following: > > If i read the config files correctly, dovecot seems to have no equivalent of > courier's IMAP_EMPTYTRASH=Trash:7 setting. > Therefore, i wrote a script that dives into the user's directories and their > maildirs. It looks like this: > ============================================> #!/bin/bash > > for pad1 in $(ls /home) > do > if [ -e "/home/$pad1/Maildir/.Prullenbak" ] > then find "/home/$pad1/Maildir/.Prullenbak/cur" -mtime +2 -type f -delete > find "/home/$pad1/Maildir/.Prullenbak/new" -mtime +2 -type f -delete > fi > if [ -e "/home/$pad1/Maildir/.Allerlei.Spam" ] > then find "/home/$pad1/Maildir/.Allerlei.Spam/cur" -mtime +2 -type > f -delete > find "/home/$pad1/Maildir/.Allerlei.Spam/new" -mtime +2 -type > f -delete > fi > done > ===========================================> Now, can i just put a script like this in /etc/hourly or do i have to add > things like stopping the dovecot deamon (i sure hope not!) in order to > prevent file-corruption? > > Or has dovecot in the meantime got a config option that does this just like > courier does?I do something similar with a nightly cron job running a perl script. There is no locking for Maildir, so you don't have to worry about that. Some previous discussion on this list suggested that ctime might be better than mtime. Mark
Hi> Therefore, i wrote a script that dives into the user's directories and their > maildirs. It looks like thisJust for reference I actually read the find manual one evening and figured out the syntax (wahey!), then 10 mins later had forgotten it all again... However, in the intervening mins I wrote this little script (watch out for line breaks, find command should all be on one line). The -ls just means that I can see it working and for debugging it means that at least you can spot if it's gone off the rails... Remove the -ls and stick it in cron when you are happy (obviously fix the start dir in this script though....) #!/bin/bash find . \( -wholename "*/.Spam/cur/*" -type f -mtime +7 -delete -ls \) , \( -wholename "*/.Spam/new/*" -type f -mtime +7 -delete -ls \) , \( -wholename "*/.Trash/cur/*" -type f -delete -ls \) , \( -wholename "*/.Trash/new/*" -type f -delete -ls \) I think the issue with mtime is that it gets reset when users open a folder and mail moves from /new to /cur ? Incidently here is a recipe to clean up large Sent Items folders... Use with caution... It demonstrates finding files based on size, date and also excluding one folder from being pruned... find . \( -wholename "*/.Sent\ Items/cur/*" \! -wholename "*/exclude_this_user/*" -type f -mtime +30 -size +5M -ls -delete \) , \( -wholename "*/.Sent\ Items/new/*" \! -wholename "*/exclude_this_user/*" -type f -mtime +30 -size +5M -ls -delete \) Ed W