[kwlug-disc] how to convince exim/valiases never to whine about non-delivery?
Robert P. J. Day
rpjday at crashcourse.ca
Tue May 4 12:44:37 EDT 2010
as a followup to a once-upon-a-time post of mine, i finally
figured out how to have exim use valiases to redirect incoming mail
simultaneously to more than one PHP script thusly:
*: "| .../dup_out.sh scr1.php scr2.php"
where dup_out.sh contains simply:
tee >(php -q $1) >(php -q $2) > /dev/null 2>&1
but here's a new wrinkle. *apparently*, if the programs being piped
into generate any output whatsoever, exim interprets this as a
delivery error and reacts accordingly by returning a non-delivery
diagnostic. grrrrrrr. and it doesn't even have to be an error
message -- i added
echo "hello world.\n";
to one of the scripts and, voila, non-delivery error message.
that redirection on the end didn't help -- after random
experimenting, i finally came up with this:
(tee >(php -q $1) >(php -q $2)) > /dev/null 2>&1
in short, run the entire thing in a subshell and throw away all
possible output, and that seems to have done the trick. but, geez,
that's hacky. and i'm not sure of the performance impact in starting
a subshell for every incoming message.
but is there a better way to do this? once exim redirects the
incoming message through the pipe, i don't care what happens in those
programs -- error codes, output, anything. is there an exim option to
specify that? the above hack will work, but i have to believe there's
a nicer way.
More information about the kwlug-disc_kwlug.org