procmail
[Top] [All Lists]

RE: Avoiding unnecessary call

2001-01-06 15:58:24
Well, you saved the call to grep when NG doesn't get set, but you
changed the call to not work.

      :0 i
      RUNNING=|grep -i "${NG}.*Running" ${VOTEDIR}/stemmingen.txt

As ever, thanks, Philip.


Make that three solutions: rather than capturing grep's output, just
check its return code:

      :0
      * ^Envelope-To: stemformulieren(_at_)sisterray\(_dot_)xs4all\(_dot_)nl
      * ^Subject: .*\/nl\.[-a-z_0-9.]+
      * ? grep -i "${MATCH}.*Running" ${VOTEDIR}/stemmingen.txt >/dev/null
      {
          [snip]

That's efficient because procmail will skip the rest of the conditions
on a recipe as soon as non-scoring condition fails, or if a scoring
condition pushes the accumulated score to "negative infinity**".  So,
if the subject doesn't match, the grep won't run.

Note that I tightened up the regexp used to match the newsgroup name,
to keep people from putting "*"s and the like in to scan for votes
going on.  Hmm, are accented characters allowed and/or used in newsgroup
names in Europe?

Not sure, but these are all good tips that I'll try to keep in mind.


** Infinity == 2147483647.0

I keep in my .procmailrc:

  INFINITY = 2147483647.0       # "magic" number limit for procmail scoring

Actually, I just added the ".0" at the end after your mail.  Not sure
if it's necessary.

But anyway, I did see some logs that implied that conditions kept
going, kept being checked, even after an "$INFINITY" one had
been triggered in a scored recipe.  Weird.  (And why do some people
use 987654321?)

--
Dallman Ross <dman(_at_)nomotek(_dot_)com>
U.S. Voicemail/FAX: +1 (415) 276-2873
Residence Telephone: +49 (0) 6122 / 98 04 46
Cellular Telephone: +49 (0) 177 / 515 34 69
Fight Spam! Join CAUCE! == http://www.cauce.org/ or
http://www.euro.cauce.org/
N.B.: For no auto-reply, use <mailto:dman+noacks(_at_)nomotek(_dot_)com>


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