I just implemented something very similar and struggled with the email not being sent.
After some investigation, I found out that the cause was that mailx is sending messages asynchronously by default, which is not compatible with the way systemd works (see the last post here)
Therefore the following option to mail is necessary: sendwait, i.e. your full mail command would be: /usr/bin/mailx -Ssendwait -s "[%i] failure notification" admin@example.com
Thanks, @jmon, it's interesting.
Although I'm using mailx via local ssmtp at my Arch Linux workstations (both at work and at home) for this - didn't notice such issues.
I'm not at all an expert in that matter, and won't investigate further. It can probably help others in my situation.
However if you're interested, I can provide you some configuration information if you guide me a bit.
Anyway thank you for your very nice work!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I just implemented something very similar and struggled with the email not being sent.
After some investigation, I found out that the cause was that
mailx
is sending messages asynchronously by default, which is not compatible with the way systemd works (see the last post here)Therefore the following option to
mail
is necessary:sendwait
, i.e. your full mail command would be:/usr/bin/mailx -Ssendwait -s "[%i] failure notification" admin@example.com
Thanks, @jmon, it's interesting.
Although I'm using
mailx
via localssmtp
at my Arch Linux workstations (both at work and at home) for this - didn't notice such issues.I'm not at all an expert in that matter, and won't investigate further. It can probably help others in my situation.
However if you're interested, I can provide you some configuration information if you guide me a bit.
Anyway thank you for your very nice work!