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