Based on https://wiki.archlinux.org/index.php/Systemd/Timers#MAILTO This can easily be used by other services, with one line added to the [Unit] section of a service: OnFailure=status-email-ops@%n.service Refs #3
12 lines
208 B
Bash
12 lines
208 B
Bash
#!/bin/bash
|
|
|
|
/usr/sbin/sendmail -t <<ERRMAIL
|
|
To: $1
|
|
From: systemd <root@$HOSTNAME>
|
|
Subject: $2
|
|
Content-Transfer-Encoding: 8bit
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
$(systemctl status --full "$2")
|
|
ERRMAIL
|