![]() |
HowTo.MakeSlugUseNailToSendAlerts HistoryHide minor edits - Show changes to markup March 02, 2007, at 10:00 AM
by -- change from-root... in .mailrc to from=root...
Changed line 14 from:
set from-root@<my.dommainname.com>@@ to:
set from=root@<my.dommainname.com>@@ October 08, 2006, at 04:35 PM
by -- smtpclient is in /usr/sbin
Changed lines 31-32 from:
to:
February 14, 2006, at 07:15 PM
by --
Changed line 15 from:
to:
Changed lines 19-22 from:
/opt/bin/nail_wrapper script: to:
You can test the new mechanism by calling
This will send you a bogus email alert about a backup failure. The "backup" keyword is the name of a stanza in /opt/local/bin/nail_wrapper script: February 14, 2006, at 06:56 PM
by --
Changed lines 31-32 from:
The script logs what it does to to:
The script logs what it does to February 14, 2006, at 06:54 PM
by --
Changed lines 23-29 from:
#!/bin/sh # bleah subject=$1 /opt/bin/nail -s $subject to:
This script needs to translate the arguments liblog.so provides to smtpclient to those appropriate for nail. liblog.so calls smtpclient like this, sending the text of the email on standard input:
where
The script logs what it does to I would appreciate any feedback if this Howto is useful to you. Enjoy!
#!/bin/bash
log_file=/var/log/mail_alert.log
while getopts s:f: arg; do
case $arg in
s) subject="$OPTARG";;
f) from_addr="$OPTARG";;
?) echo "Syntax error"
exit 1;;
esac
done
shift $(($OPTIND - 1))
to_addr="$*"
date >> $log_file
echo "Subject: $subject" >> $log_file
echo "From: $from_addr" >> $log_file
echo "To: $to_addr" >> $log_file
cat - | tee -a $log_file | /opt/bin/nail -s "$subject" "$to_addr"
February 14, 2006, at 05:46 PM
by -- How to make Slug use nail to send alerts in case your IP address is blocked
Changed lines 1-6 from:
Most sendmail servers block email sent by the standard NSLU2 smtpclient on my Slug because it appears Comcast-issued IP addresses are blocked in SPEWS. So to get around this I needed a way to have smtpclient use the Comcast smtp server to relay mail. I couldn't find a way to make the built-in smtpclient use a relay but nail, an available ipkg package, can. Here are the steps:
to:
You can configure the Slug to send you email alerts when bad things happen, like failed backups and full disks. This is done through the Admin webpage and you can specify the destination email address and the subject line of the email. However, I have never gotten my Slug to send me email with via the normal mechanisms. This is the alert process as I've gleaned from doing
The sendmail server at my ISP blocks email sent by the standard NSLU2 smtpclient on my Slug because it appears Comcast-issued IP addresses are spam black-listed. If the Linksys-provided smtpclient could be instructed to use a mail relay (Comcast provides one) it shouldn't be blocked as spam, but unfortunately the -S argument of smtpclient, to specify a mail relay host, is not supported. However, nail, an available ipkg package, does support mail relays. Here are the steps to use nail instead of the Linksys-provided smtpclient to send alerts:
/opt/bin/nail_wrapper script: #!/bin/sh # bleah subject=$1 /opt/bin/nail -s $subject February 14, 2006, at 05:07 PM
by -- How to make Slug use nail to send alerts in case your IP address is blocked
Changed lines 3-8 from:
@@
@@ to:
February 14, 2006, at 04:56 PM
by -- How to make Slug use nail to send alerts in case your IP address is blocked
Changed line 4 from:
to:
Changed line 6 from:
to:
@@ Added line 8:
@@ February 14, 2006, at 04:55 PM
by -- How to make Slug use nail to send alerts in case your IP address is blocked
Added lines 1-7:
Most sendmail servers block email sent by the standard NSLU2 smtpclient on my Slug because it appears Comcast-issued IP addresses are blocked in SPEWS. So to get around this I needed a way to have smtpclient use the Comcast smtp server to relay mail. I couldn't find a way to make the built-in smtpclient use a relay but nail, an available ipkg package, can. Here are the steps:
|