- Move
systemd-email.sh
to/usr/local/bin/
assystemd-email
with permissions755
- Move
systemd-email.conf
to/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 --fingerprint
and set the permissions onpubring.gpg
andtrustdb.gpg
accordingly 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