RadarURL

좀비 프로세스 찾기, 죽이기

by JAESOO posted May 27, 2015
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
좀비 프로세스 찾기
좀비 프로세스 죽이기

상황

top으로 프로세스 현황을 보면 가끔 좀비 프로세스가 있는 경우가 있다. (아래 예시에서는 두번째 줄 마지막에 1 zombie)

[root@zetawiki ~]# top
top - 22:01:31 up 97 days, 17:08,  1 user,  load average: 0.00, 0.00, 0.00
Tasks: 118 total,   3 running, 114 sleeping,   0 stopped,   1 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1048576k total,   990160k used,    58416k free,   180060k buffers
Swap:  2031608k total,    48520k used,  1983088k free,   203936k cached
 
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      15   0 10368  544  512 S  0.0  0.1   0:00.12 init
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:03.16 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0

좀비 찾기

찾기
ps -ef | grep defunct | grep -v grep
실행예시
[root@zetawiki ~]# ps -ef | grep defunct | grep -v grep
root     17107 21899  0 Feb25 ?        00:00:00 [myagent] <defunct>
testuser 21207 21205  0 Feb26 ?        00:00:00 [check_service.sh] <defunct>

좀비 모두 죽이기

명령어
ps -ef | grep defunct | awk '{print $3}' | xargs kill -9

좀비 수 확인

명령어
top -b -n 1 | grep zombie
ps -ef | grep defunct | grep -v grep | wc -l
실행예시
[root@zetawiki ~]# top -b -n 1 | grep zombie
Tasks: 139 total,   1 running, 136 sleeping,   0 stopped,   2 zombie
[root@zetawiki ~]# ps -ef | grep defunct | grep -v grep | wc -l
2

같이 보기

 

출처 : http://zetawiki.com/wiki/%EC%A2%80%EB%B9%84_%ED%94%84%EB%A1%9C%EC%84%B8%EC%8A%A4_%EC%B0%BE%EA%B8%B0,_%EC%A3%BD%EC%9D%B4%EA%B8%B0