Re: [exim] stop deliver when queue has more than certain num…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Phil Pennock
Date:  
À: Костырев Александр Алексеевич
CC: exim-users
Sujet: Re: [exim] stop deliver when queue has more than certain number of mails
On 2012-05-31 at 13:40 +1100, Костырев Александр Алексеевич wrote:
> Does anybody know how to stop immediate delivery when number of mails in queue has reached certain limit (e.g. 1200)?
>
> I don't want to limit number of simultaneous SMTP connections or system load just number of mails in queue
>
> Is it possible?


Yes. I'll give two approaches; the first is easiest, but not exactly
what you ask for, the second is what you ask for.

If your spamd (or whatever is causing you to want to do this) is running
on the same system, using all the CPU and driving up the load average,
then easiest is to set "queue_only_load"; that way, whenever the load
average is above that point, new messages will be queued only.

If you want exactly what you ask for, set "queue_only_file" to point to
a path; when that path exists, Exim will just queue. Delete the file,
Exim will deliver immediately once more.

Write a small script which runs "exim -bpc" and, depending upon the
result, creates or deletes that file. Invoke it every minute from cron,
or have it loop and sleep on its own and have something else ensure that
a copy of the script is running.


If you want to stop a deliver run whenever the load is too high, to give
something breathing room to recover, then the "deliver_queue_load_max"
option may be helpful.

If you want something more complex, such as running a command directly
from Exim, then use an ACL rule which has a "condition = ..." that does
whatever checks you want, and applies "control = queue_only".

-Phil