spacepaste

  1.  
  2. #!/bin/env bash
  3. from='SMART Alert <noreply@myth.zone>'
  4. body=${SMARTD_MESSAGE:-'smartdnotify default body'}
  5. subject=${SMARTD_FAILTYPE:-'Generic warning'}
  6. destination=${SMARTD_ADDRESS:-'admin@myth.zone'}
  7. ( echo "$body" | mail -vs "$subject" -r "$from" "$destination" ) 2> /run/log/smartdnotify.log
  8. [[ "$subject" == "Generic warning" ]] ||\
  9. [[ "$subject" == "EmailTest" ]] ||\
  10. wall -n "SMART Failure - ${SMARTD_FAILTYPE}: ${SMARTD_MESSAGE}"
  11.