I am trying to track down an issue with a router I am running some embedded perl code in. I my exim log it appears that the code is called twice and I'm trying to avoid that.
For a single inbound message in my logs I see:
18:41:37.471 exim[21050]: Perl says hello pid=21050
18:41:37.493 exim[21050]: 1Y1g13-0005TW-FN <= xxx@??? H=xxx [] P=esmtp S=3802 id=xxxx.org
18:41:37.916 exim[21052]: 1Y1g13-0005TW-FN Perl says hello pid=21052
18:41:37.984 exim[21052]: 1Y1g13-0005TW-FN => xxxx@??? R=pg_dbuser T=mdir_deliver
18:41:37.986 exim[21052]: 1Y1g13-0005TW-FN Completed
My router is simple, I simply want to check a condition in perl and be able to send a ":fail:" or null string back. Null string resulting into moving onto the next available router.
pg_mdircheck:
driver = redirect
allow_fail = true
allow_defer = true
domains = +local_domains
fail_verify = true
data = ${perl{mdir_check}\
{${extract{homedir}{MACRO1}}}\
{${extract{quota}{MACRO2}}}\
{IDLE_TIME}}
local_part_suffix = +*
local_part_suffix_optional
My perl code is logging to exim logfile via:
Exim::log_write("Perl says hello pid=$$");
In my perl code I do a couple of checks that I'd rather avoid duplicating. In the log it appears it's calling the perl code twice, running the router twice? Both times in the above I just returned a null string. Mail works, it just seems to be running through. The key in the logs is that once it seems to run in one PID where it has no message ID and the it runs again when it has a message-id....
Ideas on where to look or how to avoid it? The first execution is what I want, would it be as simple as looking to see if there is a null queue-id?
TIA
-Robert