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