Linux 下僵尸进程的清理方法

来源:互联网 发布:搜索引擎开发python 编辑:程序博客网 时间:2024/04/29 11:17

平时很多时候发现定时检测的脚本kill 之后,该进程会僵死在里面,无法清理。可以参考下面的方法清理:

有以下环境的进程:


#ps aux |grep monitorast.pl
root      3962  0.0  1.5   5652  3840 ?        Ss   10:13   0:00 /usr/bin/perl -w /root/script/monitorast.pl
root      5135  0.0  0.2   3920   740 pts/0    S+   10:52   0:00 grep monitorast.pl

 

# kill -9 3962 之后的进程状态:

# ps aux |grep monitorast.pl
root      3962  0.0  0.0      0     0 ?        Zs   10:13   0:00 [monitorast.pl] <defunct>
root      5196  0.0  0.2   3916   668 pts/0    R+   10:52   0:00 grep monitorast.pl

 

之后再无法使用kill 来清除,那么要清理必须从调用的进程处来kill

#ps axjf

 

    1  2616  2616  2616 ?           -1 Ss       0   0:00 crond
 2616  3960  2616  2616 ?           -1 S        0   0:00  /_ crond
 3960  3962  3962  3962 ?           -1 Zs       0   0:00      /_ [monitorast.pl] <defunct>
 3960  3970  2616  2616 ?           -1 S       51   0:00      /_ /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t

 

经过这里的判断,调用的进程没有影响系统的其他任务在运行,所以可以直接kill父进程。

# kill -9 3960

# ps aux |grep monitorast.pl
root      5364  0.0  0.2   3916   676 pts/0    R+   10:58   0:00 grep monitorast.pl

 

现在可以看到现在没有啦。

 

 

原创粉丝点击