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