我在前台启动了程序(守护程序),用“kill -9”杀死了它,但剩下了一个僵尸,用“kill -9”无法杀死它。如何杀死僵尸进程?

如果僵尸是一个死进程(已经杀死),我如何从ps aux的输出中删除它?

root@OpenWrt:~# anyprogramd &
root@OpenWrt:~# ps aux | grep anyprogram
 1163 root      2552 S    anyprogramd
 1167 root      2552 S    anyprogramd
 1169 root      2552 S    anyprogramd
 1170 root      2552 S    anyprogramd
10101 root       944 S    grep anyprogram
root@OpenWrt:~# pidof anyprogramd
1170 1169 1167 1163
root@OpenWrt:~# kill -9 1170 1169 1167 1163
root@OpenWrt:~# ps aux |grep anyprogram
 1163 root         0 Z    [anyprogramd]
root@OpenWrt:~# kill -9 1163
root@OpenWrt:~# ps aux |grep anyprogram
 1163 root         0 Z    [anyprogramd]

当前回答

我不敢尝试以上方法。

我的解决方案是htop,然后检测哪些进程有多进程。产卵并杀死-9它。

其他回答

在mac上,上面的命令/指令都不起作用。要清除僵尸进程,可以右键单击docker-icon-> troubleshoohot ->clean/purge Data。

我试着

kill -9 $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }')

这对我很有效。

您可以通过以下命令杀死僵尸进程的父进程来清除僵尸进程:

kill -HUP $(ps -A -ostat,ppid | awk '{/[zZ]/{ print $2 }')

我试着:

ps aux | grep -w Z   # returns the zombies pid
ps o ppid {returned pid from previous command}   # returns the parent
kill -1 {the parent id from previous command}

这将工作:)

我不敢尝试以上方法。

我的解决方案是htop,然后检测哪些进程有多进程。产卵并杀死-9它。