当前位置:Gxlcms > 数据库问题 > shell习题第26题:监控mysql服务

shell习题第26题:监控mysql服务

时间:2021-07-01 10:21:17 帮助过:18人阅读

="/usr/local/mysql/bin/mysql -uroot -p123456" if ! $mysql -e "show processlist" >/dev/null 2>/dev/null then echo "Mysql service is down" else $mysql -e "show slave status\G" 2>/dev/null > /tmp/slave.stat n=`wc -l /tmp/slave.stat | awk {print $1}` if [ $n -eq 0 ]; then echo "This is master." else echo "This is slave." $mysql -e "show slave status\G" | egrep Slave_IO_Running:|Slave_SQL_Running: | awk -F: {print $2} >/tmp/SQL.tmp if grep -qw "NO" /tmp/SQL.tmp then echo "The slave is down." fi fi fi

 

shell习题第26题:监控mysql服务

标签:service   核心   usr   egrep   假设   nbsp   else   $1   $2   

人气教程排行