-
Install to
/etc/systemd/system
:[email protected]
: systemd unitsend-mail
: Script invoked by[email protected]
to send an e-mail
-
Optionally configure recipient's and sender's e-mail addresses in
send-mail
:These default to
root@<hostname>
and<failed-unit-user>@<hostname>
. -
Add to the unit(s) of whose failures you would like to be notified:
[Unit] ... OnFailure=send-mail@%N.service ...
-
Reload the modified unit(s):
$ sudo systemctl daemon-reload