https://bz.apache.org/bugzilla/show_bug.cgi?id=57801

--- Comment #7 from jia...@gmail.com ---

Thanks Rainer and Christopher

It's not worth to set up a ramdisk to store the PID file.
If the PID file is stored in /tmp, the PID file may be rm-ed by someone.

The script should work in worst case even it's rare. The script should not
depend on the last state, it should be stateless.

The key point is catalina.sh treat the wrong process to be tomcat process.

Do we really need PID file to save the PID?

If we have issues with cross platform to verify the home path, maybe we could
first get the home path of the tomcat and then use this path to grep the right
PID in the result of ps(assuming the key commands in the following functions
exist in multiple unix/linux like OS).

Maybe we could get the PID of tomcat by some function like the following?


function get_tomcat_pid()
{
  declare NORMALIZED=$(echo $CATALINA_HOME | tr -s / /)
  declare NORMALIZED_PATH=$(readlink -f $CATALINA_HOME)
  if [ "$NORMALIZED" != "$NORMALIZED_PATH" ]; then
    NORMALIZED=$NORMALIZED_PATH
  fi
  if [ -z "$NORMALIZED" -a "${NORMALIZED+x}" = "x" ] ; then

                return 1
  fi

  declare pid=`ps -ef | grep  $NORMALIZED | grep -v grep | awk '{print $2}'`
  if [ -z "$pid" -a "${pid+x}" = "x" ] ; then

                return 1
  fi
  echo $pid
}


Thanks for supporting the force start.

The "abort" cases  such as can't remove or write the PID file should be abort,
it looks that it does't have permission. Maybe user use the wrong user to run
the process.

The "abort" cases such as "PID file found but no matching process was found.
Stop aborted." , "$CATALINA_PID was set but the specified file does not exist."
 should be a warning.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to