输入banner图图片脚本导航/分类

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

="/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