Home > Database > Mysql Tutorial > mysql linux定时杀掉sleep进程_MySQL

mysql linux定时杀掉sleep进程_MySQL

WBOY
Release: 2016-06-01 13:45:00
Original
1153 people have browsed it

bitsCN.com

echo "`date` killing mysql sleep process..." >> /tmp/crontab.log 
for id in `mysql -u root -pYourPassword, -e "show processlist"|grep -i -E 'slee 
p|locked'  | awk '{if($6>100){print $1}}'` 
do 
echo "killing pid $id" >> /tmp/crontab.log 
echo `mysql -u root -pYourPassword, -e "kill $id"` 
done 

mysql会有很多sleep进程和locked进程,需要定时去将它们杀掉。这个再配合crontab就可以了。

作者“持续疯长,往天那边去”
 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template