You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Michael Wang <mw...@unixlabplus.com> on 2003/01/13 03:19:47 UTC

request changes on catalina.sh and setclasspath.sh

(1)
I would like to request changes to catalina.sh:
- Save PID in a file upon starting Tomcat
- Remove the said PID file upon stopping it.

Reason for request:
This makes it possible to reliably, and programatically to
check the existence of the Tomcat java process.

"ps" command is not able to display full command and arguments.
It is difficult to tell what the process is, programatically.

The diff file:

$ diff -c catalina.sh.orig catalina.sh
*** catalina.sh.orig    Sun Jan 12 12:15:20 2003
--- catalina.sh Sun Jan 12 12:52:53 2003
***************
*** 201,206 ****
--- 201,207 ----
        -Djava.io.tmpdir="$CATALINA_TMPDIR" \
        org.apache.catalina.startup.Bootstrap "$@" start \
        >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+       echo $! > "$CATALINA_BASE"/logs/catalina.pid
    else
      "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
***************
*** 209,219 ****
--- 210,222 ----
        -Djava.io.tmpdir="$CATALINA_TMPDIR" \
        org.apache.catalina.startup.Bootstrap "$@" start \
        >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
+       echo $! > "$CATALINA_BASE"/logs/catalina.pid
    fi
  
  elif [ "$1" = "stop" ] ; then
  
    shift
+   rm -f "$CATALINA_BASE"/logs/catalina.pid
    exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
      -Dcatalina.base="$CATALINA_BASE" \

(2) Remove the check for "javac" and "jdb" in setclasspath.sh.
I do not see they are needed. JRE distribution do not have these
two binaries.

The diff:

*** setclasspath.sh.orig        Sun Jan 12 21:16:28 2003
--- setclasspath.sh     Sun Jan 12 21:16:54 2003
***************
*** 10,16 ****
    echo "This environment variable is needed to run this program"
    exit 1
  fi
! if [ ! -r "$JAVA_HOME"/bin/java -o ! -r "$JAVA_HOME"/bin/jdb -o ! -r "$JAVA_HOME"/bin/javac ]; then
    echo "The JAVA_HOME environment variable is not defined correctly"
    echo "This environment variable is needed to run this program"
    exit 1
--- 10,16 ----
    echo "This environment variable is needed to run this program"
    exit 1
  fi
! if [ ! -r "$JAVA_HOME"/bin/java ]; then
    echo "The JAVA_HOME environment variable is not defined correctly"
    echo "This environment variable is needed to run this program"
    exit 1

-- 
Michael Wang * http://www.unixlabplus.com/ * mwang@unixlabplus.com
Why pay $35 for a domain only if you can get domain and hosting at 
http://www.name2host.com/? name2host user: "mwang@unixlabplus.com"

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>