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