1#! /bin/sh 2# 3# This is a script from the smartmontools examplescripts/ directory. 4# It can be used as an argument to the -M exec Directive in 5# /etc/smartd.conf, in a line like 6# ... -m root@localhost -M exec /path/to/this/file 7# 8# See also: smartd.conf(5), smartd(8). 9# 10# $Id: Example7 4930 2019-06-28 20:01:56Z chrfranke $ 11 12if [ $# -le 3 ] || [ "$1" != "-s" ]; then 13 echo "Usage: $0 -s SUBJECT ADDRESS... < MESSAGE" 14 exit 1 15fi 16 17SUBJECT=$2 18shift; shift 19ADDRESS=$* 20 21exec /usr/sbin/sendmail $ADDRESS <<EOF 22Subject: $SUBJECT 23To: $(echo $ADDRESS | sed 's/ /, /g') 24 25$(cat -) 26EOF 27