3 # Email logs of failed e2scrub unit runs when the systemd service fails.
6 test -z "${device}" && exit 0
8 if ! type sendmail > /dev/null 2>&1; then
9 echo "$0: sendmail program not found."
13 if test -f /etc/e2scrub.conf ; then
17 hostname="$(hostname -f 2>/dev/null)"
18 test -z "${hostname}" && hostname="${HOSTNAME}"
19 service_name="e2scrub@$(systemd-escape ${device})"
21 if test -z "${recipient}" ; then
25 if test -z "${sender}" ; then
26 sender="<e2scrub@${hostname}>"
32 Subject: e2scrub failure on ${device}
34 So sorry, the automatic e2scrub of ${device} on ${hostname} failed.
36 A log of what happened follows:
38 systemctl status --full --lines 4294967295 "${service_name}") | sendmail -t -i