一、具体操作如下
1.首先在桌面新建.sh文件使用Notepad++打开
里面内容如下:
#!/bin/bash
echo "===================mysql从库监控发送短信脚本start======================="
MYSQLPORT=`netstat -na|grep "LISTEN"|grep "3306"|awk -F[:" "]+ '{print $4}'`
STATUS=$(mysql -uroot -proot -S /var/lib/mysql/mysql.sock -e "show slave status\G" | grep -i "running")
IO_state=`echo $STATUS | grep Slave_IO_Running | awk '{print $2}'`
SQL_state=`echo $STATUS | grep Slave_SQL_Running: | awk '{print $4}'`
DATA=`date +"%y-%m-%d %H:%M:%S"`
function checkMysqlStatus(){
if [ "$MYSQLPORT" &#