Wait for all processes with a certain name to finish (in bash)

血红的双手。 提交于 2019-12-07 15:00:31

问题


I would like to wait in linux (Ubuntu 11.10) for a load of processes to finish. Each of these processes has a different pid but the same name. Is it possible to do this?

EDIT:

Perhaps I should specify that I don't necessarily know what the pid are, just the process name.

EDIT:

Thanks for the answers; Kevin's seems to do what I want. However, it doesn't work in the specific application I have, so I've posted a more detailed follow-up question here.


回答1:


wait $(pgrep programName)

Ought to do it.




回答2:


wait $(pidof processname)

perhaps.




回答3:


As long as you have the pid of these processes:

wait $pid_of_process

That should do it.



来源:https://stackoverflow.com/questions/8038723/wait-for-all-processes-with-a-certain-name-to-finish-in-bash

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!