Mysql bin log files to remove the shell

Mysql bin log files to remove the shell script, share to everybody

#!/bin/sh 

DELLOG=”/usr/local/logs/del-sqlbin.log.`date +%d`”
DELTMP=”/usr/local/logs/del-sqlbin.tmp”
MAIL_ADDR=”xxx@xxx.xx”
exec &>$DELLOG

DT=`date +’%Y-%m-%d %T’`
SINGLE=0
sleep 30

hostname
echo `date +’%Y-%m-%d %T’`
echo “EXEC>>”
echo “PURGE MASTER LOGS BEFORE ‘$DT’;”
echo “PURGE MASTER LOGS BEFORE ‘$DT’;” >$DELTMP
mysql -uroot -pxxx <$DELTMP

if [ $? = 0 ];then
echo “Purge master logs sucess!”
else
echo “Purge master logs failure!”
SINGLE=1
fi
echo “——————————–”
echo

if [ $SINGLE = 1 ];then
mail -s “Purge_master_logs_err” $MAIL_ADDR <$DELLOG
fi

Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “Mysql bin log files to remove the shell”

Leave a Reply

Name:
Email:
Website:
Comment:
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>