FAQ
Hi,

Does Mailman need to lock Mailbox files? If so, how does it do so?

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...

Thanks - Rowan

Search Discussions

  • Mark Sapiro at Apr 8, 2007 at 11:34 pm

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmailman-users @
categoriespython
postedApr 8, '07 at 10:40p
activeApr 8, '07 at 11:34p
posts2
users2
websitelist.org

People

Translate

site design / logo © 2022 Grokbase