How to rename a process on Linux?

I use Python, for what it costs, but will accept answers in any applicable language.

I tried writing in /proc/$pid/cmdline, but this is only a readonly file.

I tried to assign a new line sys.argv[0], but this has no tangible effect.

Are there any other options? My program runs processes through os.system(equivalently system(3)), so the general * NIX solution using the optional spawning process will be fine.

+3
source share
3 answers

This seems to be what you are looking for ...

+3
source

*argv , C ..; , Python .

.

0

If you use subprocess.Popen instead of os.system, you can use the argument executableto specify the path to the actual executable, and pass the name that you want to show as the first element in the list, which is the parameter args.

0
source

Source: https://habr.com/ru/post/1747073/


All Articles