diff options
Diffstat (limited to 'examplescripts/Example7')
-rwxr-xr-x | examplescripts/Example7 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/examplescripts/Example7 b/examplescripts/Example7 new file mode 100755 index 0000000..7766b4b --- /dev/null +++ b/examplescripts/Example7 @@ -0,0 +1,26 @@ +#! /bin/sh +# +# This is a script from the smartmontools examplescripts/ directory. +# It can be used as an argument to the -M exec Directive in +# /etc/smartd.conf, in a line like +# ... -m root@localhost -M exec /path/to/this/file +# +# See also: smartd.conf(5), smartd(8). +# +# $Id: Example7 5442 2023-01-26 18:15:26Z chrfranke $ + +if [ $# -lt 3 ] || [ "$1" != "-s" ]; then + echo "Usage: $0 -s SUBJECT ADDRESS... < MESSAGE" + exit 1 +fi + +SUBJECT=$2 +shift; shift +ADDRESS=$* + +exec /usr/sbin/sendmail $ADDRESS <<EOF +Subject: $SUBJECT +To: $(echo $ADDRESS | sed 's/ /, /g') + +$(cat -) +EOF |