]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - examplescripts/Example6
import smartmontools 7.0
[mirror_smartmontools-debian.git] / examplescripts / Example6
CommitLineData
d2e702cf
GI
1#! /bin/sh
2
3# Send mail
ff28b140
TL
4if which mail >/dev/null 2>&1
5then
6 echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" "$SMARTD_ADDRESS"
7fi
d2e702cf
GI
8
9# Notify desktop user
ff28b140
TL
10MESSAGE="SMART Disk monitor:"
11case "$SMARTD_FAILTYPE" in
12 "EmailTest"|"Health"|"Temperature"|"Usage")
13 ;;
14 *)
15# "CurrentPendingSector", // 10
16# "OfflineUncorrectableSector", // 11
17# "FailedReadSmartErrorLog", // 7
18# "ErrorCount", // 4
19# "FailedReadSmartData", // 6
20# "FailedHealthCheck", // 5
21# "FailedOpenDevice", // 9
22# "SelfTest", // 3
23# "FailedReadSmartSelfTestLog", // 8
24 exit 0
25esac
d2e702cf
GI
26
27# direct write to terminals, do not use 'wall', because we don't want its ugly header
28for t in $(who | awk '{ print $2; }' | grep -e '^tty' -e '^pts/')
29do
30 echo "$MESSAGE
31$SMARTD_MESSAGE" >/dev/$t 2>/dev/null ||:
32done
33