标签:lis span logs ash int word shel 无法 code
由于MySQL突然新增了很多连接,超出了my.cnf所设置的最大连接数,MySQL服务无法访问,这里通过Shell脚本来删掉Sleep连接
#!/bin/bash #--------------------------- # Author:zhengwenqiang # Date: 20170714 # Description: clean sleep process # #--------------------------- IP=172.16.11.52 Username=root Password=root [ -f SleepSID ] && rm -f SleepSID mysqladmin -u$Username -p$Password processlist | sed -r ‘s/\s//g‘ | awk -F "|" ‘{if($6=="Sleep"){ print $2}}‘>SleepSID while read sID do echo $sID mysql -h$IP -u$Username -p$Password -P3306 -e "kill $sID" done<SleepSID
标签:lis span logs ash int word shel 无法 code
原文地址:http://www.cnblogs.com/cpuz/p/7169689.html