kill-mysql-sleep.sh
#!/bin/bash
#while :
#do
n=`/usr/bin/mysqladmin -uroot -pXXXXX processlist | grep -i sleep | wc -l`
date=`date +%Y%m%d\[%H:%M:%S]`
echo $n
if [ "$n" -gt 1 ]
then
for i in `/usr/bin/mysqladmin -uroot -pXXXXX processlist | grep -i sleep | awk '{print $2}'`
do
/usr/bin/mysqladmin -uroot -pXXXXX kill $i
done
# echo "sleep is too many i killed it" >> /tmp/sleep.log
# echo "$date : $n" >> /tmp/sleep.log
fi
#sleep 5
#done
~