[procmail] testing a condition with '?', need program output
by Michael Uplawski from LinuxQuestions.org on (#5Q01F)
Good evening.
In a procmail-recipe I use the exit-code of an external routine, which I have programmed to that purpose.
The recipe:
Code:# Filter ip-ranges: MOVE
:0
* !FROM_DAEMON
* !FROM_MAILER
* !^X-Loop: [my_address]
* 1^0 ? ip_in_range ~/.procmail/range_list.txt
/[path]/refused/ip_refusedI have a blog-entry on this topic of filtering IP-ranges and there is a discussion which helped me construct this recipe.
It all works quite well, as far as I can see. But now that I tend to delete the filtered mail immediately, instead of keeping it for verification, I would like to see in the procmail log, which IP-address or -range had triggered the filter.
When called on the command-line, my script ip_in_range" can print on STDOUT log-messages as configured on any debug-level like info, debug, warn or error.
The question is, how can I get this output into the procmail log as, currently, only the exit status is reported like in
Code:procmail: Executing " ip_in_range ~/.procmail/range_list.txt"
procmail: Score: 1 1 " ip_in_range ~/.procmail/range_list.txt"The exit-code is in the second line, followed by the command-line that had been executed. The mail itself is piped-in.
In case that there is no way to copy program output to the log-file, I will instead configure the loggers of my routine to write to a separate file. But I would like to avoid that.
TY in advance.
In a procmail-recipe I use the exit-code of an external routine, which I have programmed to that purpose.
The recipe:
Code:# Filter ip-ranges: MOVE
:0
* !FROM_DAEMON
* !FROM_MAILER
* !^X-Loop: [my_address]
* 1^0 ? ip_in_range ~/.procmail/range_list.txt
/[path]/refused/ip_refusedI have a blog-entry on this topic of filtering IP-ranges and there is a discussion which helped me construct this recipe.
It all works quite well, as far as I can see. But now that I tend to delete the filtered mail immediately, instead of keeping it for verification, I would like to see in the procmail log, which IP-address or -range had triggered the filter.
When called on the command-line, my script ip_in_range" can print on STDOUT log-messages as configured on any debug-level like info, debug, warn or error.
The question is, how can I get this output into the procmail log as, currently, only the exit status is reported like in
Code:procmail: Executing " ip_in_range ~/.procmail/range_list.txt"
procmail: Score: 1 1 " ip_in_range ~/.procmail/range_list.txt"The exit-code is in the second line, followed by the command-line that had been executed. The mail itself is piped-in.
In case that there is no way to copy program output to the log-file, I will instead configure the loggers of my routine to write to a separate file. But I would like to avoid that.
TY in advance.