Identifying tomcat java procs, which witch is which

|
Everything is shipping with tomcat these days. Heck it even comes in some of the HP printer toolbox stuff. Many suites of programs run multiple copies of tomcat (or other java services). Then you have a bunch of java's running and you can't tell them apart. You've probably found some tricks for finding the different java's in your program suite. Maybe your using the memory signatures, specific ports or you memorized the CLASSPATH. Here's a trick to help tag your tomcat's on unix. Use the -D switch to java to define a value that the program won't use but you can parse for in process lists. I use the CATALINA_OPTS variable in my startup scripts like
CATALINA_OPTS="-Duaa=manager"
Then that string is prepended to the java command line. It doesn't affect the program in anyway (unless you pick a really bad value that the program happens to actually use). But that simple string will help you tag your java's in the wild like this
    root   358     1  2 06:42:10 pts/1    0:03 /opt/ElluminateLive/_jvm/bin/java -Duaa=manager -Djava.endorsed.dirs=/opt/Ellum
    root   343     1  3 06:42:10 pts/1    0:02 /opt/ElluminateLive/_jvm/bin/java -Duaa=license_mgr -server -Xmx64m -Djava.awt.
    root   366     1  3 06:42:10 pts/1    0:02 /opt/ElluminateLive/_jvm/bin/java -Duaa=communication -server -Xms1536m -Xmx153