tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: [OT] How to obtain the id of the current process
Date Wed, 17 Nov 2010 23:00:30 GMT
2010/11/18 André Warnier <aw@ice-sa.com>:
> I prefer Konstantin's first suggestion.
> Now the question is : if Tomcat writes it's PID to that file, where does
> Tomcat get it from ?
>

Look into catalina.sh

echo $! > "$CATALINA_PID"

(after spawning java as a background process)


BTW, from all methods listed in the comments on

[2] http://blog.igorminar.com/2007/03/how-java-application-can-discover-its.html

I like the following:
  int pid = Integer.parseInt( ( new
File("/proc/self")).getCanonicalFile().getName() );

There are others as well.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message