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