Blame SOURCES/smartdnotify
|
|
5c7a4f |
#! /bin/sh
|
|
|
5c7a4f |
|
|
|
5c7a4f |
# Send mail
|
|
|
5c7a4f |
echo "$SMARTD_MESSAGE" | mail -s "$SMARTD_FAILTYPE" "$SMARTD_ADDRESS"
|
|
|
5c7a4f |
|
|
|
5c7a4f |
# Notify desktop user
|
|
|
5c7a4f |
MESSAGE="SMART Disk monitor:"
|
|
|
5c7a4f |
case "$SMARTD_FAILTYPE" in
|
|
|
5c7a4f |
"EmailTest"|"Health"|"Temperature"|"Usage")
|
|
|
5c7a4f |
;;
|
|
|
5c7a4f |
*)
|
|
|
5c7a4f |
# "CurrentPendingSector", // 10
|
|
|
5c7a4f |
# "OfflineUncorrectableSector", // 11
|
|
|
5c7a4f |
# "FailedReadSmartErrorLog", // 7
|
|
|
5c7a4f |
# "ErrorCount", // 4
|
|
|
5c7a4f |
# "FailedReadSmartData", // 6
|
|
|
5c7a4f |
# "FailedHealthCheck", // 5
|
|
|
5c7a4f |
# "FailedOpenDevice", // 9
|
|
|
5c7a4f |
# "SelfTest", // 3
|
|
|
5c7a4f |
# "FailedReadSmartSelfTestLog", // 8
|
|
|
5c7a4f |
exit 0
|
|
|
5c7a4f |
esac
|
|
|
5c7a4f |
|
|
|
5c7a4f |
# direct write to terminals, do not use 'wall', because we don't want its ugly header
|
|
|
5c7a4f |
for t in $(who | awk '{ print $2; }' | grep -e '^tty' -e '^pts/')
|
|
|
5c7a4f |
do
|
|
|
5c7a4f |
echo "$MESSAGE
|
|
|
5c7a4f |
$SMARTD_MESSAGE" >/dev/$t 2>/dev/null ||:
|
|
|
5c7a4f |
done
|
|
|
5c7a4f |
|