你怎么杀的是在特定期限的所有Linux进程? [英] How do you kill all Linux processes that are older than a certain age?
本文介绍了你怎么杀的是在特定期限的所有Linux进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有需要现在,然后被杀害每一个特定的服务器上的某些僵尸状突起的一个问题。我怎样才能最好的识别已经运行了一个多小时左右的时间越长的人
I have a problem with some zombie-like processes on a certain server that need to be killed every now and then. How can I best identify the ones that have run for longer than an hour or so?
推荐答案
如果他们只需要被杀害:
If they just need to be killed:
if [[ "$(uname)" = "Linux" ]];then killall --older-than 1h someprocessname;fi
如果你想看到什么它匹配
If you want to see what it's matching
if [[ "$(uname)" = "Linux" ]];then killall -i --older-than 1h someprocessname;fi
的 -i
标志将提示您是/否为每个进程相匹配。
The -i
flag will prompt you with yes/no for each process match.
这篇关于你怎么杀的是在特定期限的所有Linux进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文