定时杀死mysql中sleep的进程
时间:2021-07-01 10:21:17
帮助过:83人阅读
date=`
date +%Y%m%d\[%H:%M:%
S]`
n=`mysqladmin -uroot -p** processlist |
grep -i
sleep |
wc -
l`
echo "sleep count:$n"
if [
"$n" -gt
10 ];
then
for i
in `mysqladmin -uroot -p** processlist |
grep -i
sleep |
awk ‘$12>4000 {print $2}‘`
do
mysqladmin -uroot -p**
kill $i
done
echo "sleep is too many i killed it(time>4000)." >> /tmp/
sleep.log
echo "$date : $n" >> /tmp/
sleep.log
fi
定时杀死mysql中sleep的进程
标签:sql The col class led slist code $1 color