#!/bin/bash
#check database every day !
/usr/local/mysql/bin/mysqlcheck -uroot -p'aaa' -c --database watchmo3_data > /root/shell/database
status=`grep "[eE]rror" /root/shell/database | wc -l`
if [ $status != 0 ];then
/usr/local/mysql/bin/mysqlcheck -uroot -p'aaa' --auto-repair watchmo3_data >/dev/null 2>&1
/bin/mail -s "watchmo3_data_error,from_to watch-movie3" 13528489494@139.com
#else
# echo "mysql is ok!"
fi
#!/bin/bash
#optimize table once a week!
/usr/local/mysql/bin/mysqlcheck -uroot -p'aaa' -o --database watchmo3_data >/root/shell/optimize_table
status=`grep "[eE]rror" /root/shell/optimize_table | wc -l`
if [ $status != 0 ];then
/bin/mail -s "watchmo3_data_error,from_to watch-movie3" 13528489494@139.com
fi
echo > /usr/local/apache/logs/error_log
阅读(904) | 评论(1) | 转发(0) |