]>
Commit | Line | Data |
---|---|---|
824b5807 DW |
1 | #!/bin/bash |
2 | ||
3 | # Email logs of failed xfs_scrub unit runs | |
4 | ||
5 | mailer=/usr/sbin/sendmail | |
6 | recipient="$1" | |
7 | test -z "${recipient}" && exit 0 | |
8 | mntpoint="$2" | |
9 | test -z "${mntpoint}" && exit 0 | |
10 | hostname="$(hostname -f 2>/dev/null)" | |
11 | test -z "${hostname}" && hostname="${HOSTNAME}" | |
12 | if [ ! -x "${mailer}" ]; then | |
13 | echo "${mailer}: Mailer program not found." | |
14 | exit 1 | |
15 | fi | |
16 | ||
17 | (cat << ENDL | |
18 | To: $1 | |
19 | From: <xfs_scrub@${hostname}> | |
20 | Subject: xfs_scrub failure on ${mntpoint} | |
21 | ||
22 | So sorry, the automatic xfs_scrub of ${mntpoint} on ${hostname} failed. | |
23 | ||
24 | A log of what happened follows: | |
25 | ENDL | |
26 | systemctl status --full --lines 4294967295 "xfs_scrub@${mntpoint}") | "${mailer}" -t -i |