procmail
[Top] [All Lists]

Re: procmail: small filters need sleep 1

2004-09-05 07:42:28
Dan Jacobson wrote:

I was testing all on the same message.
And then how did the sleep 1 cure it?

I don't know. I came in when you posted to the procmail list, and your previous post there had the word "sleep" only in the subject.

Ok, here's the script I'm staking all my beans on.

And it doesn't have a single place where you're writing to true, so I don't know which of the recipes in it was giving you write errors.

:0 Whci: typhoon.lock
* TYPHOON ?? yes
* $^To:.*\<$\LOGNAME\>

What sort of characters are going to be in $LOGNAME that need escaping? Question marks? Asterisks? Parentheses? Plus signs? Backslashes?

* !^FROM_DAEMON
* !^X-Loop: $ME

$ME won't be expanded without the $-modifier.

|sleep 1 && if test `find $LAST_LOGIN_FILE -mtime +3`;\
  then formail -rD 8192 $TYPHOON_CACHE; fi

That recipe's action reads the input unless test returns failure. Sleep should have nothing to do with a procmail write error. I suggest that you move the test `find` stuff to an exit code condition instead:

 :0 Whci: typhoon.lock
 * TYPHOON ?? yes
 * $^To:.*\<$LOGNAME\>
 * !^FROM_DAEMON
 * $ !^X-Loop: $ME
 * ? test "`find $LAST_ LOGIN_FILE -mtime +3`"
 | formail -rD 8192 $TYPHOON_CACHE

I don't remember how find's exit codes work; perhaps

 * ? find $LAST_ LOGIN_FILE -mtime +3

will give right results as well.

:0 ehc
|(formail -r -IFrom:\ $ME -AX-Loop:\ $ME -IPrecedence:\ junk;\
echo -e I will read your mail after the typhoon power outage.\\n\
Maybe my phone still works, +886-4-25854780.)|$SENDMAIL -oi -t

OK. In both of those recipes procmail is feeding only the head (`h' flag) and the action is reading the head, so there should be no write error.

Can I use ...
|test `find $LAST_LOGIN_FILE -mtime +3`

:0 ahc
|formail -rD 8192 $TYPHOON_CACHE

Yes, or you can put test into an exit code condition as I just illustrated.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail