Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 681298 Details for
Bug 899187
EWS - tomcat enable security manager in sysconfig
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
tomcat5-init-solaris_to_rhel.patch
tomcat5-init-solaris_to_rhel.patch (text/x-patch), 11.76 KB, created by
David Knox
on 2011-05-10 16:08:43 UTC
(
hide
)
Description:
tomcat5-init-solaris_to_rhel.patch
Filename:
MIME Type:
Creator:
David Knox
Created:
2011-05-10 16:08:43 UTC
Size:
11.76 KB
patch
obsolete
>--- tomcat5.solaris 2011-05-10 10:05:51.437565012 -0600 >+++ tomcat5.rhel5 2011-05-10 10:06:05.547565007 -0600 >@@ -1,4 +1,4 @@ >-#!/bin/sh >+#!/bin/bash > # > # tomcat5 This shell script takes care of starting and stopping Tomcat > # >@@ -18,10 +18,17 @@ > # - heavily rewritten by Deepak Bhole and Jason Corley > # > >-NAME="`basename $0`" >-ISBOOT="`echo $NAME | sed 's/^[KS][0-9][0-9].*/true/'`" >-if [ ".$IS_BOOT" = ".true" ]; then >- NAME="`echo $NAME | sed 's/...//'`" >+# commented out until the RHEL and FC daemon functions converge >+# Source the function library >+#if [ -r "/etc/rc.d/init.d/functions" ]; then >+ #. /etc/rc.d/init.d/functions >+#fi >+ >+NAME="$(basename $0)" >+unset ISBOOT >+if [ "${NAME:0:1}" = "S" -o "${NAME:0:1}" = "K" ]; then >+ NAME="${NAME:3}" >+ ISBOOT="1" > fi > > # For SELinux we need to use 'runuser' not 'su' >@@ -32,43 +39,42 @@ > fi > > # Get the tomcat config (use this for environment specific settings) >-TOMCAT_CFG="/opt/redhat/ews/etc/sysconfig/$NAME" >+TOMCAT_CFG="/etc/tomcat5/tomcat5.conf" > if [ -r "$TOMCAT_CFG" ]; then >- . "$TOMCAT_CFG" >+ . ${TOMCAT_CFG} >+fi >+ >+# Get instance specific config file >+if [ -r "/etc/sysconfig/${NAME}" ]; then >+ . /etc/sysconfig/${NAME} > fi > > # Define which connector port to use > CONNECTOR_PORT="${CONNECTOR_PORT:-8080}" > > # Path to the tomcat launch script >-TOMCAT_SCRIPT="/opt/redhat/ews/share/$NAME/bin/catalina.sh" >+TOMCAT_SCRIPT="/usr/bin/dtomcat5" >+ >+# Path to the script that will refresh jar symlinks on startup >+TOMCAT_RELINK_SCRIPT="${CATALINA_HOME}/bin/relink" > > # Tomcat program name > TOMCAT_PROG="$NAME" >- >+ > # Define the tomcat username > TOMCAT_USER="${TOMCAT_USER:-tomcat}" > > # Define the tomcat log file >-TOMCAT_LOG="${TOMCAT_LOG:-/var/log/$NAME/catalina.out}" >- >-# Define the tomcat pid file >-CATALINA_PID="${CATALINA_PID:-/var/run/$NAME.pid}" >+TOMCAT_LOG="${TOMCAT_LOG:-${CATALINA_HOME}/logs/${NAME}-initd.out}" > > RETVAL="0" > >-if [ -x "/usr/ucb/echo" ]; then >- ECHO=/usr/ucb/echo >-else >- ECHO=echo >-fi >- > # remove when the RHEL and FC daemon functions converge > # (pulled from /etc/rc.d/init.d/functions) >-checkpid() >-{ >+function checkpid() { >+ local i > for i in $* ; do >- if [ -d "/proc/$i" ]; then >+ if [ -d "/proc/${i}" ]; then > return 0 > fi > done >@@ -77,69 +83,160 @@ > > # remove when the RHEL and FC daemon functions converge > # (pulled from /etc/rc.d/init.d/functions) >-echo_failure() >-{ >- $ECHO -n "[ FAILED ]" >+function echo_failure() { >+ echo -en "\\033[60G" >+ echo -n "[ " >+ echo -n $"FAILED" >+ echo -n " ]" >+ echo -ne "\r" > return 1 > } > > # remove when the RHEL and FC daemon functions converge > # (pulled from /etc/rc.d/init.d/functions) >-echo_success() >-{ >- $ECHO -n "[ OK ]" >+function echo_success() { >+ echo -en "\\033[60G" >+ echo -n "[ " >+ echo -n $"OK" >+ echo -n " ]" >+ echo -ne "\r" > return 0 > } > >-# See how we were called. >-start() >-{ >- $ECHO -n "Starting $TOMCAT_PROG: " >- if [ -f "/var/lock/subsys/$NAME" ] ; then >- if [ -f "$CATALINA_PID" ]; then >- read kpid < $CATALINA_PID >- if checkpid $kpid 2>&1; then >- echo "$NAME process already running" >- return -1 >- else >- echo "lock file found but no process running for" >- echo "pid \`$kpid', continuing" >+# Look for open ports, as the function name might imply >+function findFreePorts() { >+ local isSet1="false" >+ local isSet2="false" >+ local isSet3="false" >+ local lower="8000" >+ randomPort1="0" >+ randomPort2="0" >+ randomPort3="0" >+ local -a listeners="( $( >+ netstat -ntl | \ >+ awk '/^tcp/ {gsub("(.)*:", "", $4); print $4}' >+ ) )" >+ while [ "$isSet1" = "false" ] || \ >+ [ "$isSet2" = "false" ] || \ >+ [ "$isSet3" = "false" ]; do >+ let port="${lower}+${RANDOM:0:4}" >+ if [ -z `expr " ${listeners[*]} " : ".*\( $port \).*"` ]; then >+ if [ "$isSet1" = "false" ]; then >+ export randomPort1="$port" >+ isSet1="true" >+ elif [ "$isSet2" = "false" ]; then >+ export randomPort2="$port" >+ isSet2="true" >+ elif [ "$isSet3" = "false" ]; then >+ export randomPort3="$port" >+ isSet3="true" > fi > fi >- fi >- for i in $CATALINA_PID $TOMCAT_LOG >- do >- touch $i >- chown $TOMCAT_USER:$TOMCAT_USER $i >- chmod 644 "$i" > done >- $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >> $TOMCAT_LOG 2>&1 >+} >+ >+function makeHomeDir() { >+ if [ ! -d "$CATALINA_HOME" ]; then >+ echo "$CATALINA_HOME does not exist, creating" >+ if [ ! -d "/var/lib/${NAME}" ]; then >+ mkdir -p /var/lib/${NAME} >+ cp -pLR /var/lib/tomcat5/* /var/lib/${NAME} >+ fi >+ mkdir -p $CATALINA_HOME ${CATALINA_HOME}/conf /var/cache/${NAME}/temp \ >+ /var/cache/${NAME}/work /var/log/${NAME} >+ for i in temp work; do >+ ln -fs /var/cache/${NAME}/${i} ${CATALINA_HOME}/${i} >+ done >+ for i in common server shared webapps; do >+ ln -fs /var/lib/${NAME}/${i} ${CATALINA_HOME}/${i} >+ done >+ ln -fs /var/log/${NAME} ${CATALINA_HOME}/logs >+ cp -pLR /etc/tomcat5/* ${CATALINA_HOME}/conf/ >+ cp -pLR /usr/share/tomcat5/bin $CATALINA_HOME >+ cp -pLR /var/cache/tomcat5/work/* ${CATALINA_HOME}/work/ >+ chown ${TOMCAT_USER}:${TOMCAT_USER} /var/log/${NAME} >+ fi >+} >+ >+function parseOptions() { >+ options="" >+ options="$options $( >+ awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \ >+ $TOMCAT_CFG >+ )" >+ if [ -r "/etc/sysconfig/${NAME}" ]; then >+ options="$options $( >+ awk '!/^#/ && !/^$/ { ORS=" "; >+ print "export ", $0, ";" }' \ >+ /etc/sysconfig/${NAME} >+ )" >+ fi >+ TOMCAT_SCRIPT="$options $TOMCAT_SCRIPT" >+} >+ >+# See how we were called. >+function start() { >+ echo -n "Starting ${TOMCAT_PROG}: " >+ if [ -f "/var/lock/subsys/${NAME}" ] ; then >+ if [ -f "/var/run/${NAME}.pid" ]; then >+ read kpid < /var/run/${NAME}.pid >+ if checkpid $kpid 2>&1; then >+ echo "$NAME process already running" >+ return -1 >+ else >+ echo "lock file found but no process running for" >+ echo "pid $kpid, continuing" >+ fi >+ fi >+ fi >+ export CATALINA_PID="/var/run/${NAME}.pid" >+ touch $CATALINA_PID >+ chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID >+ if [ "$CATALINA_HOME" != "/usr/share/tomcat5" ]; then >+ # Create a tomcat directory if it doesn't exist >+ makeHomeDir >+ # If CATALINA_HOME doesn't exist modify port number so that >+ # multiple instances don't interfere with each other >+ findFreePorts >+ sed -i -e "s/8005/${randomPort1}/g" -e "s/8080/${CONNECTOR_PORT}/g" \ >+ -e "s/8009/${randomPort2}/g" -e "s/8443/${randomPort3}/g" \ >+ ${CATALINA_HOME}/conf/server.xml >+ fi >+ touch $TOMCAT_LOG >+ chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG >+ if [ "$RELINK" = "yes" ]; then >+ $TOMCAT_RELINK_SCRIPT >+ fi >+ if [ "$SECURITY_MANAGER" = "true" ]; then >+ $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start -security" >> ${TOMCAT_LOG} 2>&1 >+ else >+ $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >> ${TOMCAT_LOG} 2>&1 >+ fi > RETVAL="$?" >- if [ "$RETVAL" -eq 0 ]; then >+ if [ "$RETVAL" -eq 0 ]; then > echo_success >- touch /var/lock/subsys/$NAME >+ touch /var/lock/subsys/${NAME} > else > echo_failure > fi >- echo "" >+ echo > return $RETVAL > } > >-status() >-{ >+function status() { > RETVAL="1" >- if [ -f "$CATALINA_PID" ]; then >- read kpid < $CATALINA_PID >+ if [ -f "/var/run/${NAME}.pid" ]; then >+ read kpid < /var/run/${NAME}.pid > if checkpid $kpid 2>&1; then >- echo "$0 is already running \`$kpid'" >+ echo "$0 is already running (${kpid})" > RETVAL="0" > else >- echo "lock file found but no process running for pid \`$kpid'" >+ echo "lock file found but no process running for pid $kpid" > fi > else >- pid="`pgrep -u tomcat java`" >+ pid="$(pgrep -u tomcat java)" > if [ -n "$pid" ]; then >- echo "$0 running \`$pid' but no PID file exists" >+ echo "$0 running (${pid}) but no PID file exists" > RETVAL="0" > else > echo "$0 is stopped" >@@ -148,44 +245,41 @@ > return $RETVAL > } > >-stop() >-{ >- STOP_VERBOSE="false" >- $ECHO -n "Stopping $TOMCAT_PROG: " >- if [ -f "/var/lock/subsys/$NAME" ]; then >- $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT stop" >> $TOMCAT_LOG 2>&1 >+function stop() { >+ local STOP_VERBOSE="false" >+ echo -n "Stopping $TOMCAT_PROG: " >+ if [ -f "/var/lock/subsys/${NAME}" ]; then >+ $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT stop" >> ${TOMCAT_LOG} 2>&1 > RETVAL="$?" > if [ "$RETVAL" -eq "0" ]; then > count="0" >- if [ -f "$CATALINA_PID" ]; then >- read kpid < $CATALINA_PID >- until [ "`ps -p $kpid | grep -c $kpid`" -eq "0" ] || \ >+ if [ -f "/var/run/${NAME}.pid" ]; then >+ read kpid < /var/run/${NAME}.pid >+ until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \ > [ "$count" -gt "$SHUTDOWN_WAIT" ]; do >- if [ ".$STOP_VERBOSE" = ".true" ]; then >- echo "" >- echo "waiting for processes \`$kpid' to exit" >+ if [ "$STOP_VERBOSE" = "true" ]; then >+ echo -n -e "\nwaiting for processes $kpid to exit" > fi > sleep 1 >- count="`expr $count + 1`" >+ let count="${count}+1" > done > if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then > if [ "$STOP_VERBOSE" = "true" ]; then >- echo "" >- echo "killing processes which didn't stop after $SHUTDOWN_WAIT seconds" >+ echo -n -e "\nkilling processes which didn't stop" >+ echo -n -e "after " >+ echo -n "$SHUTDOWN_WAIT seconds" > fi > kill -9 $kpid > fi > echo_success > if [ "$count" -gt "0" ]; then >- echo "" >+ echo -n -e "\n" > fi > fi >- rm -f /var/lock/subsys/$NAME $CATALINA_PID >+ rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid > else > echo_failure > fi >- else >- echo "[ STOPPED ]" > fi > } > >@@ -193,18 +287,22 @@ > # See how we were called. > case "$1" in > start) >+ parseOptions > start > ;; > stop) >+ parseOptions > stop > ;; > restart) >+ parseOptions > stop >- sleep 2 >+ sleep 2 > start > ;; > condrestart) >- if [ -f "$CATALINA_PID" ]; then >+ if [ -f "/var/run/${NAME}.pid" ]; then >+ parseOptions > stop > start > fi >@@ -213,8 +311,9 @@ > status > ;; > version) >- "$JAVA_HOME/bin/java" \ >- -classpath "$CATALINA_HOME/server/lib/catalina.jar" \ >+ parseOptions >+ "${JAVA_HOME}/bin/java" \ >+ -classpath "${CATALINA_HOME}/server/lib/catalina.jar" \ > org.apache.catalina.util.ServerInfo > ;; > *) >@@ -223,3 +322,4 @@ > esac > > exit $RETVAL >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 899187
:
681296
|
681297
| 681298 |
681299