Ratnadeep
Ratnadeep

Reputation: 133

Clojure - Can I assign custom name to a process started using 'lein run'

Is there a way to assign a custom name to a process started using the command below

~lein run

The process stared by the above command is as displayed below -

~lsof -i tcp:8082
COMMAND   PID       USER   FD   TYPE             DEVICE SIZE/OFF NODE     NAME
java    96029 <username>   89u  IPv6 0xa04954e1ea972891      0t0  TCP *:us-cli (LISTEN)

Upvotes: 0

Views: 140

Answers (1)

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91617

It's possible though it gets a bit ugly and likely not worth the trouble

You would need to make a symlink to java with an alternate name, and modify lein to call that instead of calling java. You could do this by writing a lein plugin for instance. When Linux starts a process the name of the process it uses the name of the file from which the process was run as the name of the process thereafter, so you need to change the name of the file that gets run to create the process that will open the port, in this case "java".

If all you needed was an easy way to find either the process that opened the port or it's parent process then you could just make a script with a good name that called lein run. This would show up in the output from ps though not from lsof.

Upvotes: 1

Related Questions