remove entry from deliver.db
Bron Gondwana
brong at fastmail.fm
Sat Apr 14 06:32:07 EDT 2007
On Fri, Apr 13, 2007 at 11:25:08AM -0700, Andrew Morgan wrote:
> On Fri, 13 Apr 2007, Derek T. Yarnell wrote:
>
> >On Thu, 2007-04-12 at 13:40 -0400, Greg A. Woods wrote:
> >>At Thu, 12 Apr 2007 11:32:49 -0400, Derek T. Yarnell wrote:
> >>Subject: remove entry from deliver.db
> >>>
> >>>Is there a way to remove an entry from the deliver.db? Like a
> >>>spam/virus solution quarantined a message, we delivered it into the
> >>>cyrus mailbox and user deleted it. We tried to re-deliver the message
> >>>and it now gets caught in the duplicate checker.
> >>
> >>That sounds like a design flaw in your spam/virus system.
> >>
> >>The delivery of a message to Cyrus should only ever have to happen once.
> >>The "quarantine" area could just be another folder.
> >
> >Well I am not really here to debate the design of the spam/virus system
> >because it is coming from another department. But it may be a design
> >flaw not to allow a management of of the deliver.db so my initial
> >question stands, is there a way to delete entries out of the deliver.db
> >before they are just purged in the normal (3day in redhat) cycle?
>
> There are no tools shipping with Cyrus to modify deliver.db. You'd have
> to write your own, unless someone else in Cyrus land has already done so.
cyr_dbtool. It's in 2.3.8.
sudo -u cyrus /usr/cyrus/bin/cyr_dbtool \
/var/imap/deliver.db berkeley show '<messageid>' | \
cut -f1 | sudo -u cyrus /usr/cyrus/bin/cyr_dbtool \
/var/imap/deliver.db berkeley delete
Should do the trick at a pinch. Apologies for the formatting, it's not
quite a one-liner!
sudo -u cyrus /usr/cyrus/bin/cyr_dbtool \
/var/imap/deliver.db berkeley show '<messageid>' | less
run this by hand first. It will show all the records that begin with
that messageid. You want this to be piped to less because it contains
unprintables(woot). If there's anything you want to keep in there you
might need a grep or grep -v in the pipeline too. Probably after the
cut.
The cut isn't strictly required, but I think it's safer to pipe just the
keys and not the data through to delete in case the data confuses it
(i.e contains newlines or something, ick)
By the way, I have no idea how cyr_dbtool handles tabs in the database key.
I've never considered it because I only wrote it for dealing with
mailboxes.db which is relatively "nice", or the seen database with
similarly polite keys. I expect it will fail to encode them and hence
the "delete" won't work because it only has partial keys. Sorry about that.
Bron.
More information about the Info-cyrus
mailing list