> 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:

$ SMARTD_ADDRESS='some.one@some.where' \
  SMARTD_MAILER=/usr/share/smartmontools/smartd-runner \
  /usr/share/smartd_warning.sh --dryrun

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
mail=/usr/bin/mail
sendmail=/usr/sbin/sendmail
if [ -x $mail ]; then
  echo "$SMARTD_FULLMESSAGE" | $mail -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS
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

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1833331

Title:
  10mail script should use sendmail command, not the mail command

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/smartmontools/+bug/1833331/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to