MYSQL 检查脚本
/root/shell/check_database.sh
#!/bin/bash
#check database every day !
/usr/local/mysql/bin/mysqlcheck -uroot -p'Ka#7' -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'Kaok987' --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
MYSQL 优化脚本
[root@watch-movie3 ~]# cat /root/shell/optimize_table.sh
#!/bin/bash
#optimize table once a week!
/usr/local/mysql/bin/mysqlcheck -uroot -p'K##87' -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
阅读(902) | 评论(1) | 转发(0) |