On Aug 21, 2013, at 6:51 PM, 永豪 <[email protected]> wrote:
> I haven't go through many codes indeed, but TS-2143 make me sad, I love ATS
> because in most case, we can provide a working solution for your requirement.
> when you grow up, with big volumes, you will find out that ATS still work,
> and you may discover more features than your imagine. it is a good user
> experience compare to some other system, when you find out that the system
> builder is really 'user oriented'.
Hmmmm, this seems incredibly harsh. Attached is an alarms_example.sh script,
that works exactly as the code used to do, except, it is less confusing. If you
like, we can put that back in there.
Fwiw, I think this is much worse for the "newbies". If you don't know what you
are doing, you will be sending emails from "nobody" to "admin", and you have no
idea why. Best case scenario, the email vanish. Worst case scenario, they will
eventually fill up /var/log/mail.
I do agree with the review concerns, so if the consensus is to roll this back,
lets do it fast.
-- leif
ostype=`(uname -s) 2>/dev/null`
if [ "$ostype" = "Linux" ]; then
SENDMAIL="/usr/sbin/sendmail"
else
SENDMAIL="/usr/lib/sendmail"
fi
if [ ! -x $SENDMAIL ]; then
echo "$0: Could not find $SENDMAIL program"
exit 1
fi
if [ $# -eq 2 ]; then
msg="`hostname` $1"
email_from_name="traffic server"
email_from_addr="nobody"
email_to_addr="admin"
result=`(echo "From: $email_from_name <$email_from_addr>"; echo "To:
$email_to_addr"; echo "Subject: $msg"; echo; date) | $SENDMAIL -bm
$email_to_addr`
if [ "$result" = "" ]; then
echo
echo "[example_alarm_bin.sh] sent alarm: $msg";
echo
exit 0
else
echo
echo "[example_alarm_bin.sh] sendmail failed"
echo
exit 1
fi
else
# give a little help
echo "Usage: example_alarm_bin.sh <message> [<email_from_name>
<email_from_addr> <email_to_addr>]"
exit
fi