프로세스 일괄삭제 > 개발

본문 바로가기

사이트 내 전체검색

개발

리눅스 프로세스 일괄삭제

페이지 정보

냐잉 23-08-28 15:30 조회 2,023회 댓글 0건

본문

리눅스에서 mysql 접속
mysql -u root -p

프로세스 확인
show processlist;

프로세스 죽이기
kill 프로세스명; 

프로세스 일괄삭제
select concat('KILL ',id,';') from information_schema.processlist where db='ypcungrasoyou' into outfile '/tmp/a.txt';

!where 조건에 컬럼명이 들어가면 된다
예 Id, User,db,Command..등등
그리고 ''안의 내용은 필드명
그리고 난 후
source /tmp/b.txt;

입력하면 조건에 해당하는 프로세스가 일괄삭제됌

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)
이런식으로

select concat('KILL ',id,';') from information_schema.processlist where db='ypcungrasoyou' into outfile '/tmp/a.txt'
가 발생되는 경우는 tmp파일에 a.txt라는 파일이 있기때문에 파일명을 다르게 입력하면 됌

db나와서
cd /tmp/

경로 들어가서
rm -rf *.txt
Yh Corp. © Designed by yh.