[Mailman-Users] Locking mailbox files

Mark Sapiro msapiro at value.net
Mon Apr 9 01:34:31 CEST 2007


Rowan Sylvester-Bradley wrote:
>
>Does Mailman need to lock Mailbox files? If so, how does it do so?


Mailman locks lists, not Mailbox files.


>My hosting company runs Mailman. I'm writing a script which modifies my
>mailbox files to delete old messages, and I need to be able to lock the
>files before I do so to stop any other process from trying to modify
>them at the same time. The way that Mailman does this may give me a clue
>how to do it...


Locks are generally implemented as lock files. I.e. to lock a file
named /a/b/c, attempt to create /a/b/c.lock (or some other file whose
name is a function of /a/b/c). If that file doesn't already exist, you
can access /a/b/c and then remove /a/b/c.lock when you have commited
your changes. If it does already exist, the resource is locked by
another process; you have to wait and retry.

This scheme relies on every process wanting access to the resource
obeying the same rules and using the same lockfile name. Fortunately,
this is usually the case for Mailbox files. See

man lockfile

-- 
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Users mailing list