[MySQL] 상태가 sleep 인것 정리하기

#!/bin/sh
NOW=$(date +"%m-%d-%Y")
FILE="/root/sleep_processes.$NOW.txt"
/var/lib/mysql-5.1.40/bin/mysql -uroot --password='password' -e "select concat('KILL ',id,';')  into outfile '/tmp/sleep_processes.txt' from information_schema.processlist where State = 'User sleep'"
/var/lib/mysql-5.1.40/bin/mysql -uroot --password='password' -e "source /tmp/sleep_processes.txt;"
if [ -s "/tmp/sleep_processes.txt" ]; then
        cp /tmp/sleep_processes.txt $FILE
fi
rm -f /tmp/sleep_processes.txt

https://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=81951&page=2

이전글
다음글

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다