procmail
[Top] [All Lists]

best way to code a single-use recipe

2003-08-10 10:55:10
Academic question:

What's the best way to code a single-use recipe? That is, once any message meets the conditions and the action is run successfully, it vanishes from the code and is not tried again.

One way is for the action to create a dotfile of some sort, and to have the nonexistence of the file as the first condition. Another is to have the code in an INCLUDERC, whose commands include renaming itself. If the action is a script, and the one time you want it run it runs on a `c'opy with write errors `i'gnored, the script can rename itself as it exits. (Maybe the INCLUDERC or the script should truncate itself to null rather than renaming itself, so that there's no error when it doesn't show up at all?)

If the recipe saves a message to a previously nonexistent folder, testing for the existence of the folder will prevent it from running again.

But maybe there's some approach that essentially comments out the entire recipe or erases it the first time it successfully matches and executes, or even the first time it successfully matches. If someone could come up with that, it would be an interesting addition to procmail's bag of tricks.


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