based on https://wiki.archlinux.org/index.php/Systemd/Timers#MAILTO
- Move
systemd-email.sh
to/usr/local/bin/systemd-email
- Move
[email protected]
to/etc/systemd/system/
- Put
OnFailure=OnFailure=status-email-alerts@%n.service
into the[Unit]
section of a service
Create file /usr/local/bin/systemd-email
touch /usr/local/bin/systemd-email && chmod +x /usr/local/bin/systemd-email
Or via wget:
wget -O /usr/local/bin/systemd-email https://gist.githubusercontent.com/whattheserver/ae29ae89e8bbcb4dd28f834db8608eb9/raw/303445769bf9a5b8eeb05adedfd0b87229b740ca/systemd-email.sh && chmod +x /usr/local/bin/systemd-email;
Edit if desired:
$EDITOR /usr/local/bin/systemd-email
Create file
touch /etc/systemd/system/[email protected]
Edit:
via editor
$EDITOR /etc/systemd/system/[email protected]
via systemctl (Recommended)
systemctl edit --full [email protected]
Or download and immediately edit it vis systemctl to change the email.
wget -O /etc/systemd/system/[email protected] https://gist.githubusercontent.com/whattheserver/ae29ae89e8bbcb4dd28f834db8608eb9/raw/55a4946b643e3d4fd93d1270a480c6dc66f360bb/[email protected] && systemctl edit --full [email protected]
To test Set your sleep to lower number in /usr/local/bin/systemd-email
and execute with your desired email and service name:
/usr/local/bin/systemd-email [email protected] YOUR_SERVICE_HERE.service