![](/img/trans.png)
[英]How to kill a linux child_process.spawn using javascript?
[英]How to kill one process and it's all child process Linux?
user1 27913 41004 4 15:54 pts/202 00:00:02 python demo.py
user1 31916 27913 0 15:55 pts/202 00:00:00 python demo.py
user1 31917 27913 0 15:55 pts/202 00:00:00 python demo.py
user1 31918 27913 0 15:55 pts/202 00:00:00 python demo.py
user1 31919 27913 0 15:55 pts/202 00:00:00 python demo.py
user1 31920 27913 0 15:55 pts/202 00:00:00 python demo.py
user1 31921 27913 0 15:55 pts/202 00:00:00 python demo.py
user1 31922 27913 0 15:55 pts/202 00:00:00 python demo.py
user1 31923 27913 0 15:55 pts/202 00:00:00 python demo.py
有一個進程27913
,我想殺死它以及它的所有子進程,我如何使其起作用?
更新python腳本:
下面是我的demo.py
from concurrent.futures import ProcessPoolExecutor
import time
def foo(num):
time.sleep(0.5)
print(num)
if __name__ == "__main__":
while True:
with ProcessPoolExecutor(max_workers=8) as exe:
exe.map(foo, range(1,4))
例如,通過ID殺死該進程:使用此命令列出您的python文件ps -A| grep python
ps -A| grep python
並殺死進程: kill 27913
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.