Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start a process with a name

Tags:

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.

like image 207
cache Avatar asked Jun 21 '12 00:06

cache


1 Answers

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

like image 51
user2829759 Avatar answered Sep 21 '22 10:09

user2829759