summaryrefslogtreecommitdiffstats
path: root/examplescripts/Example6
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/Example6
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 'examplescripts/Example6')
-rwxr-xr-xexamplescripts/Example633
1 files changed, 33 insertions, 0 deletions
diff --git a/examplescripts/Example6 b/examplescripts/Example6
new file mode 100755
index 0000000..d1217e1
--- /dev/null
+++ b/examplescripts/Example6
@@ -0,0 +1,33 @@
+#! /bin/sh
+
+# Send mail
+if which mail >/dev/null 2>&1
+then
+ echo "$SMARTD_FULLMESSAGE" | mail -s "$SMARTD_SUBJECT" "$SMARTD_ADDRESS"
+fi
+
+# Notify desktop user
+MESSAGE="SMART Disk monitor:"
+case "$SMARTD_FAILTYPE" in
+ "EmailTest"|"Health"|"Temperature"|"Usage")
+ ;;
+ *)
+# "CurrentPendingSector", // 10
+# "OfflineUncorrectableSector", // 11
+# "FailedReadSmartErrorLog", // 7
+# "ErrorCount", // 4
+# "FailedReadSmartData", // 6
+# "FailedHealthCheck", // 5
+# "FailedOpenDevice", // 9
+# "SelfTest", // 3
+# "FailedReadSmartSelfTestLog", // 8
+ exit 0
+esac
+
+# direct write to terminals, do not use 'wall', because we don't want its ugly header
+for t in $(who | awk '{ print $2; }' | grep -e '^tty' -e '^pts/')
+do
+ echo "$MESSAGE
+$SMARTD_MESSAGE" >/dev/$t 2>/dev/null ||:
+done
+