procmail
[Top] [All Lists]

Re: counting messages since last login

1996-04-10 16:42:29
Guy Geens suggested to Timothy Luoma:

L> Here's the recipe (the first in my .procmailrc)

L> :0c
L> |count_mail

G> The errors are caused by the script running twice, using the same count
G> file.  You need a lockfile. Add a `:' behind the :0c and you should be
G> just fine.

You won't be fine, not yet.

First, there is nothing in the action line from which procmail can infer a
name for the local lockfile.  You need to supply a name for it. 

Second, you have to use the `w' flag or the `W' flag, or procmail will remove
the local lockfile as soon as count_mail accepts the input; you want procmail
to wait until count_mail exits or another instantiation of count_mail may be
started before the first one finishes.

Third, count_mail doesn't read the incoming message, so procmail will com-
plain about unused input unless you add the `i' flag.

Finally, since count_mail won't read the incoming message, you might as well
feed only the head (likely to be the smaller part) to save procmail the
trouble of feeding the entire text to a program that won't even use it.

  :0Whic:count_mail.lock
  | count_mail

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