Subject: Re: Part-time global lockfiles

From: Nowan <[email-masked]>
Date: Sat, 4 Mar 95 20:20:43 CST

David Tamkin suggested:

> Jeremy Hankins asked,
> 
> | I've considered using an alias
> | or script to run my mailer that would create a lockfile and remove it
> | when I'm done reading my mail.
> | There are (at least) two problems with that -- a) procmail will often be
> | locked out of my mailfiles for long periods of time,
> 
> If your mail reading threatens to go for longer than seventeen minutes, shell
> out of your mailer and touch the lockfiles or exit your mailer (and the
> script) and restart the script.

My mail reading can easily go on for hours -- not only do I compose
messages from within my mailer I often recieve (and compose) long
messages that I like to take some time to go through.

To solve this problem I decided to set things up so that when I'm in
my mailer procmail will shunt all mail into a special temorary file.
When I through with my mailer I can run procmail to sort the temporary
file into the correct mail files.  However, I ran into a bit of a
problem.  I included the folowing recipe at the begining of my
.procmailrc:

:0:
* ? test -f $DEFAULT$LOCKTEXT
temp.mail

The current form evidently tries to run the file called test in the
current directory.  Then the mail is sorted into it's (ordinarily)
apropriate folder.  How do I first of all check for the existence of a
lockfile without creating one if it doesn't exist, and, if the
lockfile is there, stick the mail into a temporary file?

Thanks a lot,

----Jeremy Hankins (aka Nowan)[email-masked]
-----------------http://bj-111.rh.uchicago.edu-------------------

Language is perhaps the most powerful hallucinogen known to mankind.

---

From: [email-masked] (David W. Tamkin)
Date: Sat, 4 Mar 1995 21:45:31 -0600 (CST)

Jeremy Hankins got to the next bend and found more potholes in the road:

| When I through with my mailer I can run procmail to sort the temporary
| file into the correct mail files.  However, I ran into a bit of a
| problem.  I included the folowing recipe at the begining of my
| .procmailrc:
| 
| :0:
| * ? test -f $DEFAULT$LOCKTEXT
| temp.mail

Hmm.  When you exit your mailer and run procmail on $MAILDIR/temp.mail, be
sure NOT to use formail's -n option.

| The current form evidently tries to run the file called test in the
| current directory.  Then the mail is sorted into [its] (ordinarily)
| apropriate folder.  How do I first of all check for the existence of a
| lockfile without creating one if it doesn't exist, and, if the
| lockfile is there, stick the mail into a temporary file?

My guess is that when procmail was compiled, it found /bin/test and
configured itself to look for an executable named test instead of invoking a
shell when it sees 'test'.  You apparently gave procmail a $PATH where your
folder directory (or worse, dot) is ahead of /bin.

Suggestion 1: if you have nothing in your folder directory named `[', try
this:

  :0:
  * ? [ -f $DEFAULT$LOCKEXT ]
  temp.mail

Suggestion 2: force a shell by adding a gratuitous characater from
$SHELLMETAS, like so:

  :0:
  * ? test -f $DEFAULT$LOCKEXT ;
  temp.mail

The best way to tell whether procmail is running a program itself or invoking
a shell is to use a logfile and to turn VERBOSE on.  If the logfile shows the
program name and its parameters all separated by commas, procmail is running
it; if it shows them without commas (generally with spaces or tabs, however
you wrote the recipe), then a shell is running the program.

David W. Tamkin  Box 3284  Skokie, Illinois  60076-6284
[email-masked]    MCI Mail: 426-1818   +1 312 714 5610