procmail
[Top] [All Lists]

Re: dynamci filters

2008-08-14 17:23:54


I don't think the i-flag does any good on a nested recipe.
You'll probably see an error in your log from that.  It
won't cause anything to do anything untoward, though.

Algorithmically, you don't need to run the same test each
time.  If the first nested recipe failed, then the test is negative and
you can run the second recipe without a condition line.

Even the E-flag is superfluous, as is the second (inner) nested-brace
set, because if the first nested recipe evaluated true, the action
will have been performed and procmail will have exited already.

Dallman

Indeed you are correct Dallman.  I tried and saw exactly what you said would 
happen in the logs.  Here is a revised version.  Does not seem to be working 
correctly still.  

1. 1st Problem email received
- It creates the tempfile but does not forward to pager.  Second email received 
with same subject does show in log that it is getting forwarded to nopager
2. 2nd Problem email received
- forward email to nopager
3. Recover email received
- tempfile is deleted but no forwarding to pager happens

# pager on 1st notification and set to not pager until the tmp file is removed
:0
* ^Subject:.*PROBLEM alert - server123 is CRITICAL
{
    # If file exists then forward to nopager
    :0
    * ? test -e $tempfile
    ! nopager(_at_)domain(_dot_)com
    # If file does not exist then create file and forward to pager
    :0
    | touch $tempfile
    :0
    ! pager(_at_)domain(_dot_)com
}

# Received Recovery, remove tmp file and forward to pager
:0
* ^Subject:.*RECOVERY alert - server123 is OK
{
    :0
    | rm -f $tempfile
    :0
    ! pager(_at_)domain(_dot_)com
}

# Forward the rest to pager
:0
! pager(_at_)domain(_dot_)com

-george


      
____________________________________________________________
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

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