[Dovecot] replacement for IMAP_EMPTYTRASH=Trash:7

2008-02-07 Thread Rody
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


Re: [Dovecot] replacement for IMAP_EMPTYTRASH=Trash:7

2008-02-07 Thread Rody
Op vrijdag 8 februari 2008 00:43, schreef Steve Annessa:
> Use mail-expire.

According to
http://linuxappfinder.com/package/mail-expire
this is an app for mbox files. I'm using maildir folders, so it doesn't look 
like it's usable in my case.

Rody

>
> On Feb 7, 2008 5:58 PM, Rody <[EMAIL PROTECTED]> 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



Re: [Dovecot] replacement for IMAP_EMPTYTRASH=Trash:7

2008-02-07 Thread Rody
Op vrijdag 8 februari 2008 03:26, schreef Mark Nienberg:
> 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

That makes sence. I just realize that the mtime method does not garantee that 
only mails exist in the mailbox which are not older than 3 days. 

Rody


Re: [Dovecot] Deleting messages from MailDir

2008-02-12 Thread Rody

Funny, I asked a few days ago a similar question with the subject: 
[Dovecot] replacement for IMAP_EMPTYTRASH=Trash:7
You may want to look for the responses to that question as it's essentially 
the same.
In short: you can do this with a find command to remove older mails. There 
should be no issues as maildir files don't need to be locked in order to do 
it properly.
The opinions vary slightly when it comes to using mtime or ctime. I've chosen 
ctime because i believe using mtime will not garantee that there aren't any 
mails left which are actually older than 30 days. I believe there are cases 
where mtime may get changed, where ctime will not. Also, ctime starts 
counting from the moment the mail gets dropped in a certain mailbox.
Anyway for 30 day's i'd say you need ctime +29 or mtime +29 as the man pages 
explain that +0 means actually up until 1 day old.

Regards,
Rody

Op dinsdag 12 februari 2008 19:15, schreef Matt Richards:
> Hello,
>
> I have dovecot running with MailDir as a backend to store email and I would
> like to remove mail that is older that 30 days.
>
> I can do this by running 'find' on the MailDir but will this cause any
> issues with dovecot?
>
> Thanks,
>
> Matt.


Re: [Dovecot] Deleting messages from MailDir

2008-02-12 Thread Rody

From what i have seen, you're absolutely correct. It looks like the use of 
ctime or mtime depends on wether you want the message removed x days after it 
was moved to say the trash folder (ctime) or will be removed x days after it 
originally arrived in the inbox (mtime). My personal opinion is currently 
that i would like it removed x days after it was placed in a certain folder, 
hence i use ctime.

Rody

Op woensdag 13 februari 2008 00:43, schreef Bill Cole:
> At 10:45 PM +0100 2/12/08, Rody  imposed structure on a stream of
>
> electrons, yielding:
> >The opinions vary slightly when it comes to using mtime or ctime. I've
> > chosen ctime because i believe using mtime will not garantee that there
> > aren't any mails left which are actually older than 30 days. I believe
> > there are cases where mtime may get changed, where ctime will not. Also,
> > ctime starts counting from the moment the mail gets dropped in a certain
> > mailbox.
>
> Yes, but you may also care that ctime is reset when a client has
> Dovecot move a message from one subfolder to another within a
> Maildir. I'm not sure why Dovecot does it, but a look at the messages
> in the non-INBOX parts of my Maildir reveals that the ctime is always
> later than the mtime, and the contents (Received headers) makes it
> clear that Dovecot sets the mtime of messages to the original mtime
> (i.e. original delivery time) when copying them.
>
> Hopefully Timo will speak up on this, but I have a vague recollection
> of him saying that Dovecot never modifies message contents as a
> matter of principle, and it seems to me that the design of Maildir
> assumes that the mailstore server follows that principle rigorously.
> That should make mtime quite static for an individual file, and it
> looks to me like Dovecot even makes an effort to preserve the
> delivery time of a message by replicating the mtime from the original
> file to the new one when copying a message between subfolders.