Re: [exim] test database conn to prevent rejecting messages

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Graeme Fowler
Datum:  
To: exim-users
Betreff: Re: [exim] test database conn to prevent rejecting messages
On Fri, 2013-10-04 at 18:16 -0400, josh trier wrote:
> I am writing an ACL that a few of my relay servers will use. All is fine
> with code. However if the central database server can not be connected to I
> want to disable the ACL to prevent messages from being rejected.
>
> Right now this is what happens if DB conn fails (example of stopping mysqld
> service)
>
> SMTP>> 451 Temporary local problem - please try later451 Temporary
> local problem - please try later
> LOG: MAIN REJECT
>   H=localhost [127.0.0.1] F=<root@???> temporarily
> rejected after DATA: MYSQL     connection failed: Can't connect to
> local MySQL server through socket '/var/lib/mysql/mysql.sock'    (2)


Although that is indeed a rejection, it's a temporary one. Well-behaved
remote servers receiving that will simply re-queue the mail and try
again later.

Jasen's readsocket approach might have legs, but I think I'd create a
shell or perl script that can give you a "DB is available" or "DB is
dead" response and call that from a warn statement using $run.

That way you could set a variable and check for its value in later ACLs,
at the cost of making one extra DB connection per message.

How to do that will be left as an exercise :)

Graeme