xfs_scrub_fail 641 B

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