I have two java processes which run using the same file name, MyApp.jar
(for example).
/usr/java/latest/bin/java -jar MyApp.jar
These jars exist in different places and use different configurations.
I want to be able to kill one process, but don't know how to distinguish between the two. I execute:
ps aux | grep [M]yApp.jar
And get:
admin 21509 0.8 0.1 1199908 20484 ? Sl 08:21 0:00 /usr/java/latest/bin/java -jar MyApp.jar
admin 21585 6.7 0.1 1199764 20084 ? Sl 08:21 0:00
I've thought of creating the process with some dummy parameter to be able to distinguish them:
/usr/java/latest/bin/java -jar MyApp.jar MyAppTheFirst
and
/usr/java/latest/bin/java -jar MyApp.jar MyAppTheSecond
But this seems a bit wrong to me. Is there a better way?
jar
, or needs stopping as the service it is using is down and the logs are just filling up, etc. – Peter Wood Apr 17 at 18:23