summaryrefslogtreecommitdiffstats
path: root/examplescripts/Example7
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:14:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 17:14:45 +0000
commit43e8530e93493bb978c446a2023134bdd4277e50 (patch)
treee8c0d3c0c394b17381f48fb2d288f166b4f22440 /examplescripts/Example7
parentInitial commit. (diff)
downloadsmartmontools-43e8530e93493bb978c446a2023134bdd4277e50.tar.xz
smartmontools-43e8530e93493bb978c446a2023134bdd4277e50.zip
Adding upstream version 7.4.upstream/7.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xexamplescripts/Example726
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