-
Install to
/etc/systemd/system
:send-mail@.service
: systemd unitsend-mail
: Script invoked bysend-mail@.service
to send an e-mail
-
Optionally configure recipient's and sender's e-mail addresses in
send-mail
:RECIPIENT=jdoe@example.com SENDER=jschmoe@example.com
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