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