--On Wednesday, June 16, 2021 11:46 AM +0300 Mantas Mikulėnas
<grawity@xxxxxxxxx> wrote:
What does "needs to send mail" even mean? That /usr/sbin/sendmail can
be called to queue a message? That you can talk to localhost:25?
A well behaving MTA actually make /usr/sbin/sendmail work without the
main mail daemon to be up. The mail is then only enqueued, but not
dispatched, but that'll be done once the service is fully up.
Hmm, I was going to post the same at first, but it doesn't really work in
reverse -- if you want to send mail on shutdown and if the goal of
After=postfix is "run my ExecStop before postfix gets stopped", then
ability to queue doesn't help all that much.
This isn't that intractable. The objective is to allow the message to
escape the box to the next hop before shutdown. (On startup there's no
issue.) So I can issue a queue flush in the ExitStop and then poll the
queue for empty until a timeout (say, 5 seconds) is reached to allow the
queue to drain. Admittedly this won't work on a system that's getting
flooded with mail from other sources. On a lightly-loaded system, just
sleeping for 2-5 seconds is enough to let the message escape.
My current workflow for a reboot is to mail myself the result of uptime and
then start a ping from another box to monitor when it comes back up. So I'm
trying to script away from that to just looking at that server's mail
folder.
My bigger concern is how to use one Unit file to handle different MTAs.
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel