How can I start a process with a different name?

Solution 1:

You can use the exec shell builtin:

bash -c "exec -a MyUniqueProcessName <command> &"

<command> replaces the current shell, no new process is created, that's why I'm starting a new shell to call exec.

Then you can kill the process with:

pkill -f MyUniqueProcessName

You can start more than one process under the same name, then pkill -f <name> will kill all of them.

Solution 2:

AMItac / The Solaris Agency

I had an issue with an audio transcoding tool that ran 3 times under the same name.

I did following. Went to the bin directory and copyied the transcoding script 3 times and gave each one a new name. tc-1 , tc-2 , tc-3 (it´s a small tool so it doesn't eat much drive space (with large binaries you shouldn't use this method)

so the process started with an unique Name and can be killed with this unique Name without the danger of killing other transcoding processes i want to continue.

another trick MIGHT work....

add a #bash script Name.sh, make it executable. Type in your commands there and start the bash script itself. On Centos it uses then the Bashscript Name you excecuted and not the bin Name itself.

Hope something helps someone out there.