Uploaded image for project: 'JBoss Web Server'
  1. JBoss Web Server
  2. JWS-189

tomcat init scripts should use variable CATALINA_PID

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • JWS 3.0.2 DR3
    • JWS 3.0.1 ER1
    • tomcat7, tomcat8
    • None
    • Release Notes
    • Documented as Resolved Issue

      There is config variable named CATALINA_PID in /etc/tomcat8/tomcat8.conf with default value:

      CATALINA_PID="/var/run/tomcat8.pid"
      

      This configuration file is sourced in /etc/rc.d/init.d/tomcat8 init file but instead of this variable there is used (on quite many places!) manual value

      "/var/run/${NAME}.pid"
      

      which might lead into situation that actual pid file might not be placed where configuration itself says.

      I propose to fix this by using variable from configuration file. If there might be risk that some user is using very old conf where such variable CATALINA_PID is not set then right after the sourcing of the configuration file in init file there might be something like this:

      CATALINA_PID="${CATALINA_PID:-/var/run/${NAME}.pid}"
      

      and further in init script then using this variable...

      Another problem is that when I actually modify the default CATALINA_PID value in /etc/tomcat8/tomcat8.conf and try to start tomcat then it says that it has failed because in tomcat start script in /usr/sbin/tomcat8 there is code like this:

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

      which attempts to write PID into CATALINA_PID. Althought with current implementation this file does not exist and command fails. This return code is then propagated back into init script itself.

      Same problem also affects tomcat7 init file.

            dknox_jira David Knox (Inactive)
            jstourac@redhat.com Jan Stourac
            Jan Stourac Jan Stourac
            Lucas Costi Lucas Costi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: