I have a Java process which starts a subprocess using ProcessBuilder.java. The subprocess is a third party binary, written in C. Is there a way to change the default name of the child process which is printed in ps command output in Linux?
Asked
Active
Viewed 234 times
0
-
1https://stackoverflow.com/q/3075682 – Robert Harvey Mar 19 '19 at 18:12
-
1I believe there is no nice way for this. You could use something hackish, like starting `bash -c "exec -a foo /bin/sleep 100"`, which should do about what you want – Ctx Mar 19 '19 at 18:27
-
@Ctx : This worked for me. I can accept it if you can post your comment as an answer. Feel free to add this line to your answer : `new ProcessBuilder("bash", "-c", "exec -a newProcessName startProcessCommand")` – rainhacker Mar 25 '19 at 13:58