You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by fredk2 <fr...@gmail.com> on 2008/04/10 19:05:54 UTC

Can Tomcat set its pid in a file?

Hi,

Currently the pid file is set when you run catalina.sh (unix/linux)

      if [ ! -z "$CATALINA_PID" ]; then
        echo $! > $CATALINA_PID
      fi

In some situation (when using sudo, su, catalina.out piped to a log rotation
program) it is harder and possibly prone to error to get the right pid - $!
might not be the pid of the JVM.

Apache httpd sets the pid file and cleans it up .... Is there a simple
way/sample to have Tomcat set the pid file during its bootstrap and not the
startup shell script ? 

Rgds
Fred
-- 
View this message in context: http://www.nabble.com/Can-Tomcat-set-its-pid-in-a-file--tp16610493p16610493.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Can Tomcat set its pid in a file?

Posted by fredk2 <fr...@gmail.com>.

Interestingly I cannot use jsvc. We are using a Java 5 jvm option -javaagent
which is not supported by jsvc.  I was looking at jws which does a little
bit more (although missing the cool -user option), but that seems to have
become a commercial venture.

Fred


David Smith-2 wrote:
> 
> You could use jsvc instead of the shell scripts.
> 
> --David
> 
> fredk2 wrote:
> 
>>Hi,
>>
>>Currently the pid file is set when you run catalina.sh (unix/linux)
>>
>>      if [ ! -z "$CATALINA_PID" ]; then
>>        echo $! > $CATALINA_PID
>>      fi
>>
>>In some situation (when using sudo, su, catalina.out piped to a log
rotation
>>program) it is harder and possibly prone to error to get the right pid -
$!
>>might not be the pid of the JVM.
>>
>>Apache httpd sets the pid file and cleans it up .... Is there a simple
>>way/sample to have Tomcat set the pid file during its bootstrap and not
the
>>startup shell script ? 
>>
>>Rgds
>>Fred
>>  
>>
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-Tomcat-set-its-pid-in-a-file--tp16610493p16616237.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Can Tomcat set its pid in a file?

Posted by David Smith <dn...@cornell.edu>.
You could use jsvc instead of the shell scripts.

--David

fredk2 wrote:

>Hi,
>
>Currently the pid file is set when you run catalina.sh (unix/linux)
>
>      if [ ! -z "$CATALINA_PID" ]; then
>        echo $! > $CATALINA_PID
>      fi
>
>In some situation (when using sudo, su, catalina.out piped to a log rotation
>program) it is harder and possibly prone to error to get the right pid - $!
>might not be the pid of the JVM.
>
>Apache httpd sets the pid file and cleans it up .... Is there a simple
>way/sample to have Tomcat set the pid file during its bootstrap and not the
>startup shell script ? 
>
>Rgds
>Fred
>  
>


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