Start a process with a name

牧云@^-^@ 提交于 2019-12-10 01:50:12

问题


Basically I want to dynamically start some processes which may create their own children processes, also I want to kill a certain group of processes I just created whenever I want. One way I could think of is to start processes with a name(to distinguish as a group), then use pkill to kill them by the name. The question is how to start a process with a name so that I can use pkill to kill them by the name? I am open to other solutions as well.


回答1:


There is very similar question on serverfault with some answers that might help you




回答2:


How can I start a process with a different name?

bash -c "exec -a <MyProcessName> <Command>"

Then you can kill the process with:

pkill -f MyProcessName



来源:https://stackoverflow.com/questions/11130229/start-a-process-with-a-name

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