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