On Tue, 3 Mar 2009, Timo Sirainen wrote:
On Tue, 2009-03-03 at 13:54 -0800, Mark Hedges wrote:
How does IMAP lock the /var/spool/mail/user file?
mbox_read_locks and mbox_write_locks defines it.
mbox_read_locks = fcntl mbox_write_locks = dotlock fcntl
Unfortunately openwebmail only respects dotlocks. (or flock, but procmail doesn't use flock, or doesn't say it does.)
So what if my script is reading the messages to delete with IMAP, then a user logs into openwebmail, reads their inbox, selects messages to delete, but then my script deletes them, and then they try the delete operation on the mailbox that is no longer in sync?
Here's my problem: I'm writing a script to expire old or oversize mail through a series of archive folders. I don't want to take the whole server down to do this, nor does it seem like I would have to lock the user out entirely if I can manage to emulate the locks correctly.
How about doing it via IMAP? Then you wouldn't need to worry about locking or anything else.
1 select mailbox 2 search before 01-jun-2006 3 store <those messages> +flags.silent \deleted 4 expunge
That would be great if it meant that users could not log into openwebmail at the same time, but it doesn't, AFAICT, without establishing dotlocks. I am just assuming that users will not log in through IMAP and openwebmail at the same time.
I like my original suggestion of turning off all services while the script runs, but that's not a solution, apparently.
I'm also thinking maybe I can lock the user's password, use
verbose_proctitle to make sure they're not logged in and/or
kick the individual out with kill
, then run the script,
which I've verified does block procmail delivery.
The matrix has you!
Mark