#!/bin/bash
 
pwd=
user=
cd /usr/script
for host in `grep -v -e '^#' -e '^$' mysqlhost`
do
        [[ `mysql -u$user -p"$pwd" -h"$host" --execute="repair table mysql.time_zone"` ]] &> /dev/null
if (( $? != 0 ))
then
        ( echo "HELO hi";
        sleep 1;
        echo "auth login";
        sleep 1;
        echo ""
        sleep 1;
        echo ""
        sleep 1;
        echo "mail from:<xxxxxxxx@139.com>";
        sleep 1;
        echo "rcpt to:<xxxxxxxx@139.com>";
        sleep 1;
        echo "data";
        sleep 1;
echo "From: <xxxxxx@139.com>";
        echo "Subject: $host mysql-error";
        echo  ;
        echo ".";
        sleep 1;
        echo "quit" ) | telnet smtp.139.com 25
 
        echo "`date +%b\ %d\ %T` -- $host -- mysql-error" >> /var/log/my.log
fi
done