]> git.proxmox.com Git - mirror_smartmontools-debian.git/blob - examplescripts/Example6
import smartmontools 7.0
[mirror_smartmontools-debian.git] / examplescripts / Example6
1 #! /bin/sh
2
3 # Send mail
4 if which mail >/dev/null 2>&1
5 then
6 echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" "$SMARTD_ADDRESS"
7 fi
8
9 # Notify desktop user
10 MESSAGE="SMART Disk monitor:"
11 case "$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
25 esac
26
27 # direct write to terminals, do not use 'wall', because we don't want its ugly header
28 for t in $(who | awk '{ print $2; }' | grep -e '^tty' -e '^pts/')
29 do
30 echo "$MESSAGE
31 $SMARTD_MESSAGE" >/dev/$t 2>/dev/null ||:
32 done
33