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