如何知道是否是可执行或二进制是处理一些请求或忙闲 (不运行状态)
我想要停止/杀的过程基础上的处理状况的可执行的。
如何知道是否是可执行或二进制是处理一些请求或忙闲 (不运行状态)
我想要停止/杀的过程基础上的处理状况的可执行的。
你可以检查的过程国家代码的过程中使用 ps
. 这可以给你一个更详细地了解目前的状态给予过程。
根据 man ps
:
PROCESS STATE CODES Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process: D uninterruptible sleep (usually IO) I Idle kernel thread R running or runnable (on run queue) S interruptible sleep (waiting for an event to complete) T stopped by job control signal t stopped by debugger during the tracing W paging (not valid since the 2.6.xx kernel) X dead (should never be seen) Z defunct ("zombie") process, terminated but not reaped by its parent
然后你可以做些什么,如:
ps --no-headers -o pid,state -p PID
这将输出的一个字母代表的过程的国家从上述的,对于给定的过程PID。
你也可以做 ps --no-headers -o pid,state -p $(pgrep app_name)
. 这将输出的当前状态的每一个过程,由一个给予应用程序。