- Move
systemd-email.shto/usr/local/bin/assystemd-emailwith permissions755 - Move
systemd-email.confto/usr/local/etc/systemd-email/ - Move
[email protected]to/etc/systemd/system/ - Create public keyring for GnuPG in
/usr/local/etc/systemd-email/withgpg --homedir /usr/local/etc/systemd-email/ --no-default-keyring --keyring pubring.gpg --fingerprintand set the permissions onpubring.gpgandtrustdb.gpgaccordingly or to644 - Import your public key with
gpg --homedir /usr/local/etc/systemd-email/ --import
To enable reports for failures on an example service myservice.service edit the unit file with systemctl edit myservice and add
OnFailure=status-email-user@%i
or
OnSuccess=status-email-user@%i
for emails on service stop with exit code 0, or just simply both (useful for services like btrfs-scrub@)
Inspired by this Stackoverflow post and ArchWiki entry