procmail
[Top] [All Lists]

Re: Recipe - 2 actions in one rule

2001-12-16 06:26:32
I'm trying to get two actions in one rule.  I was a light turned on an
e-mail response that the command was issued.  I get the action just fine but
I never get a response.  I'm sure I'm missing something dumb.

:0 Bi h c
* !^FROM_DAEMON
* !^X-Loop: testing(_at_)my(_dot_)domain"
* ^^LIGHTS\/.+
|/root/bottlerocket-0.04c/br A2,3,4,5,6,7,8,9 $MATCH ; \
 (formail -r -A"Precedence: junk" \
 -A"X-Loop: testing(_at_)my(_dot_)domain" ; \
 echo "Mail received and action performed."; \
 echo | date \
 tail /var/log/messages \
 ) | $SENDMAIL -t

So the mail is redirected to your bottlerocket program.  Then you run a
formail program without any input.  That's a normal unix shell thing,
not a procmail thing - the program after the semicolon doesn't get another
copy of the text that was given to the program before the semicolon.

Do you want the output from the br program to go through formail?

If so, that first semicolon should be a pipe.

Or do you want the original mail to go through formail?

In which case you have various options.  One of which is:

 :0 Bi h c
 * !^FROM_DAEMON
 * !^X-Loop: testing(_at_)my(_dot_)domain"
 * ^^LIGHTS\/.+
 |/root/bottlerocket-0.04c/br A2,3,4,5,6,7,8,9 $MATCH 

 :0 Aihc
 (formail -r -A"Precedence: junk" \
  -A"X-Loop: testing(_at_)my(_dot_)domain" ; \
  echo "Mail received and action performed."; \
  echo; date ;\
  tail /var/log/messages \
  ) | $SENDMAIL -t

You also had:

  echo | date \
  tail /var/log/messages

which doesn't make a lot of sense.  So I've assumed that you meant

  echo; date; \
  tail /var/log/messages

Hope that helps,
Martin
-- 
Martin McCarthy                 /</                  PGP key available
    `Procmail Companion'        \>\  http://www.ancient-scotland.co.uk
     Addison Wesley             /</    http://www.ehabitat.demon.co.uk
_______________________________________________
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>