Blame SOURCES/smartdnotify

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