mysq批量删除sleep进程

由于sleep进程比较多,就写个特简单的脚本,批量删除下,只保留5个即可

#!/bin/sh


n=`/export/servers/mysql/bin/mysqladmin processlist -uroot -pxxxxx|grep -i sleep |wc -l`

echo $n


if [ "$n" -gt 10 ]

then

for i in `/export/servers/mysql/bin/mysqladmin processlist -uroot -pxxxxxx|grep -i sleep |awk '{print $2}'`

do

`/export/servers/mysql/bin/mysqladmin -uroot -p123456 kill $i`


done

fi


你可能感兴趣的:(mysql,sleep)