> At quick glance, I don't see a quick and easy way to test email notifications.
1. '-M test' in smartd.conf enables test messages. Here a quick example which does not touch smartd.conf and runs only one smartd check cycle in debug mode:
2. Or: run smartd's internal warning script directly. This does not require root and does not access any device. Set SMARTD_ADDRESS from '-m ...' and SMARTD_MAILER from '-M exec ...'. Example:
> At quick glance, I don't see a quick and easy way to test email notifications.
1. '-M test' in smartd.conf enables test messages. Here a quick example which does not touch smartd.conf and runs only one smartd check cycle in debug mode:
# sed -n '/^DEVICESCAN/s,$, -M test,p' /etc/smartd.conf \
| /usr/sbin/smartd -c - -q onecheck
2. Or: run smartd's internal warning script directly. This does not require root and does not access any device. Set SMARTD_ADDRESS from '-m ...' and SMARTD_MAILER from '-M exec ...'. Example:
$ <email address hidden>' \ MAILER= /usr/share/ smartmontools/ smartd- runner \ share/smartd_ warning. sh --dryrun
SMARTD_
/usr/
Remove --dryrun to actually exec .../smartd-runner.
@Christian E. - A possible enhancement for 10mail would be to fall back to sendmail if mail is not available. Something like:
#!/bin/bash /usr/sbin/ sendmail FULLMESSAGE" | $mail -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS
mail=/usr/bin/mail
sendmail=
if [ -x $mail ]; then
echo "$SMARTD_
elif [ -x $sendmail ]; then
$sendmail $SMARTD_ADDRESS <<EOF
Subject: $SMARTD_SUBJECT
To: ${SMARTD_ADDRESS// /, }
$SMARTD_FULLMESSAGE
EOF
else
echo "Found neither $mail nor $sendmail"
exit 1
fi