平时很多时候发现定时检测的脚本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

 

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

 

 

GitHub 加速计划 / li / linux-dash
13
2
下载
A beautiful web dashboard for Linux
最近提交(Master分支:4 个月前 )
186a802e added ecosystem file for PM2 5 年前
5def40a3 Add host customization support for the NodeJS version 5 年前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐