procmail
[Top] [All Lists]

Re: WARNINGS in procmail.man

1997-07-10 18:03:00
At 08:28 AM 7/11/97 +0900, Mitsuru Furukawa wrote:

Could anyone kindly explain what following paragraph 
specifically suggesting?

WARNINGS
    You should create a shell script that uses  lockfile(1)  be-
    fore invoking your mail shell on any mailbox file other than
    the system mailbox (unless of course, your mail  shell  uses
    the  same  lockfiles (local or global) you specified in your
    rcfile).

Well, if you're screwing around with a file (as a user -- ANY user with
write access, so this is root, you, and anybody you might foolishly grant
rights to your mailbox to), and Procmail comes along and processes an
incoming message, your mailbox and/or at least the message, is very likely
going to have a problem.

No two apps can write to a single file at the same time unless they do so
cooperatively with each other - since this isn't the case, lockfiles are
used in procmail to ensure that it doesn't write to a file which something
else is (or might be) writing to.

What kind of shell script should I create?

What is your favourite shell?

When should I execute it?

Before/after (create/delete the lockfile) doing anything with the mailbox
file.  Perhaps you're going to manually run GZIP to append some data to one
of your mailboxes (say you're consolodating two into one) - methinks you
should lock the mailbox before messing with it, so that a procmail recipe
doesn't attempt to mess with it while you're working on it.

Quite possibly, you'd write it as a script that makes the lockfile(s), runs
the app, then removes the lockfile(s).  "runs the app" could in fact be a
parameter option to the scriptfile itself (allowing you to make a single
script that simply wraps around your chosen process:

        maillock elm

where maillock is the name of your scriptfile, and elm is the name of the
program it ends up running after it has created the lockfile(s).

How could I know what kind of lockfiles mail shell is using?

I'm not familiar with specific lockfile techniques of mail shells (I rarely
use the mailer on the host, since I use a POP mail client).  Check the
manpage for your chosen mailer - it might be mentioned there.

Since all mail I read is forwarded into a separate POP mailbox, and
otherwise procmail is acting as a spamfilter, bot, and listserver, I simply
store a copy of the incoming messages into various .gz files - I don't
really run into lockfile issues when doing this.

What would happen if I did not follow this WARNING?

You could lose data.  This is widely accepted as a BadThing(tm).

The reason I am asking is that
my spool got temporary unaccessable from shell.

This problem doesn't sound like a procmail issue.  The mail spool is the
"system mailbox" referred to above, and is exempt from the need for special
lockfiles.

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

<Prev in Thread] Current Thread [Next in Thread>