procmail
[Top] [All Lists]

Re: What is causing this?

2000-09-28 13:28:05
Ron asked,

| I have been tweaking my procmailrc. and when checking the logs I noticed
| this:

| procmail: Lock failure on "2000/09/FreeBSD-ports/.lock"
| >From owner-freebsd-ports(_at_)FreeBSD(_dot_)ORG  Wed Sep 27 23:11:39 2000
|  Subject: Re: latest Xmms still doesn't compile
|   Folder: 2000/09/FreeBSD-ports/new/_LZ,YFu05.lunatic.oneinsane.net 3077

It comes from this recipe:

| :0:                             # Anything from FreeBSD Ports mail list
| * ^Sender(_dot_)*-freebsd-ports(_at_)FreeBSD(_dot_)ORG
| $MONTH/FreeBSD-ports/

You don't really need a local lockfile on a save to a directory anyway, so
just drop the second colon.

| MONTH=`date +%Y/%m`

If your MUA gives you postmark ("From ") lines, you can extract that
information from there instead of forking date.

| # ----- check for existance of this month's directory -----

Existence, Ron, existence.

| :0 ic
| * ? test ! -d $MONTH
| | mkdir -p $MONTH && chmod 0700 $MONTH

You can save the chmod and the shell.  If your version of mkdir supports
-m, change the action to this:

 mkdir -m 700 -p $MONTH

If not, do this:

 oldumask=$UMASK

 UMASK=077
 :0 ic
 * ? test ! -d $MONTH
 | mkdir -p $MONTH

 UMASK=$oldumask

| # ----- add Lines: header for Maildir mail -----
| :0 bw
| LINES=|wc -l | tr -d " "
| 
| :0 fhw
| |formail -a "Lines: $LINES"

You don't need wc, tr, nor the shell that links them:

 :0fhw
 * ! ^Lines: [0-9]+$
 * 1^1 B ?? ^.*$
 * -1^0
 | formail -i "Lines: $="

Some explanations there:

1. As long as you're using -a, there's no reason even to start formail
running if there's already a Lines: header containing a positive integer and
you're going to accept it.  On the other hand, if there is an invalid Lines:
header, we'll let the -i option rename it Old-Lines:.

2. Counting lines in the body by scoring always counts one too many, so the
third condition corrects that.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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