You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eduardo Ponce de León <ep...@latinomobile.com.mx> on 2008/08/29 00:54:53 UTC

ERROR Starting 2nd instance of Tomcat

 

I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
tomcat folder and modified the server.xml files with different ports. I've
also created a startup script, but when I run the script I am getting this
error... Can anyone help please!!

[root@balder312 tomcat5-test]# tomcat5-test start In the config file
Starting tomcat5-test: [ FAILED ] 

This is what i get in my catalina.out 

-sh: line 0: export: `In the config file': not a valid identifier
/bin/bash: /usr/bin/tomcat5-test: Permission denied
-sh: line 0: export: `In the config file': not a valid identifier
/bin/bash: /usr/bin/tomcat5-test: Permission denied

This is my startup script... #!/bin/bash # # tomcat5 This shell script takes
care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN INIT
INFO
# Provides: tomcat5
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Release implementation for Servlet 2.4 and JSP 2.0
# Short-Description: start and stop tomcat
### END INIT INFO
# # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
# - heavily rewritten by Deepak Bhole and Jason Corley
# # 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'
if [ -x "/sbin/runuser" ]; then
SU="/sbin/runuser"
else
SU="su"
fi
# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
if [ -r "$TOMCAT_CFG" ]; then
. ${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="/usr/bin/tomcat5-test"
# 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
RETVAL="0"
# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function checkpid() {
local i
for i in $* ; do
if [ -d "/proc/${i}" ]; then
return 0
fi
done
return 1
}
# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_failure() {
echo -en "\\033[60G <file:///\\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)
function echo_success() {
echo -en "\\033[60G <file:///\\033[60G> "
echo -n "[ "
echo -n $"OK"
echo -n " ]"
echo -ne "\r"
return 0
}
# 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
done
}
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-test/* /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 /usr/share/tomcat5-test/* 
${CATALINA_HOME}/conf/
cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
cp -pLR /usr/share/tomcat5-test/* 
${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-test" ];
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
$TOMCAT_RELINK_SCRIPT
$SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
$TOMCAT_LOG 2>&1
RETVAL="$?"
if [ "$RETVAL" -eq 0 ]; then
echo_success
touch /var/lock/subsys/${NAME}
else
echo_failure
fi
echo
return $RETVAL
}
function status() {
RETVAL="1"
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})"
RETVAL="0"
else
echo "lock file found but no process running for pid $kpid"
fi
else
pid="$(pgrep -u tomcat java)"
if [ -n "$pid" ]; then
echo "$0 running (${pid}) but no PID file exists"
RETVAL="0"
else
echo "$0 is stopped"
fi
fi
return $RETVAL
}
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 "/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 -n -e "\nwaiting for processes $kpid to exit"
fi
sleep 1
let count="${count}+1"
done
if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
if [ "$STOP_VERBOSE" = "true" ]; then
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 -n -e "\n"
fi
fi
rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
else
echo_failure
fi
fi
}
# See how we were called.
case "$1" in
start)
parseOptions
start
;;
stop)
parseOptions
stop
;;
restart)
parseOptions
stop
sleep 2 
start
;;
condrestart)
if [ -f "/var/run/${NAME}.pid" ]; then
parseOptions
stop
start
fi
;;
status)
status
;;
version)
parseOptions
"${JAVA_HOME}/bin/java" \ -classpath
"${CATALINA_HOME}/server/lib/catalina.jar" \
org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
{start|stop|restart|condrestart|status|version}"
exit 1
esac
exit $RETVAL

 

Eduardo Ponce de León

Desarrollador

 

Latino Mobile 

---------------------------------------------------

Moliere 450A-101, México D.F.

(T) +5255 -   52 50 65 52

(M)+5255 -   55 06 37 16

(E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx

---------------------------------------------------

 <http://www.latinomobile.com.mx/> www.latinomobile.com.mx

El Mejor Contenido Latino para Móviles

 


RE: ERROR Starting 2nd instance of Tomcat

Posted by Eduardo Ponce de León <ep...@latinomobile.com.mx>.
It is not a tomcat script.. I've clearly stated that I've created that script to startup the 2nd instance!!

Eduardo Ponce de León
Desarrollador
 
Latino Mobile 
---------------------------------------------------
Moliere 450A-101, México D.F.
(T) +5255 -   52 50 65 52
(M)+5255 -   55 06 37 16
(E) rcuesta@latinomobile.com.mx
---------------------------------------------------
www.latinomobile.com.mx
El Mejor Contenido Latino para Móviles


-----Original Message-----
From: Len Popp [mailto:len.popp@gmail.com] 
Sent: Thursday, August 28, 2008 10:49 PM
To: Tomcat Users List
Subject: Re: ERROR Starting 2nd instance of Tomcat

Where does that "In the config file" come from? It's not in a Tomcat
script, is it?
-- 
Len

On Thu, Aug 28, 2008 at 18:54, Eduardo Ponce de León
<ep...@latinomobile.com.mx> wrote:
>
>
> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
> tomcat folder and modified the server.xml files with different ports. I've
> also created a startup script, but when I run the script I am getting this
> error... Can anyone help please!!
>
> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
> Starting tomcat5-test: [ FAILED ]
>
> This is what i get in my catalina.out
>
> -sh: line 0: export: `In the config file': not a valid identifier
> /bin/bash: /usr/bin/tomcat5-test: Permission denied
> -sh: line 0: export: `In the config file': not a valid identifier
> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>
> This is my startup script... #!/bin/bash # # tomcat5 This shell script takes
> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN INIT
> INFO
> # Provides: tomcat5
> # Required-Start: $network $syslog
> # Required-Stop: $network $syslog
> # Default-Start:
> # Default-Stop:
> # Description: Release implementation for Servlet 2.4 and JSP 2.0
> # Short-Description: start and stop tomcat
> ### END INIT INFO
> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
> # - heavily rewritten by Deepak Bhole and Jason Corley
> # # 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'
> if [ -x "/sbin/runuser" ]; then
> SU="/sbin/runuser"
> else
> SU="su"
> fi
> # Get the tomcat config (use this for environment specific settings)
> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
> if [ -r "$TOMCAT_CFG" ]; then
> . ${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="/usr/bin/tomcat5-test"
> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
> RETVAL="0"
> # remove when the RHEL and FC daemon functions converge
> # (pulled from /etc/rc.d/init.d/functions)
> function checkpid() {
> local i
> for i in $* ; do
> if [ -d "/proc/${i}" ]; then
> return 0
> fi
> done
> return 1
> }
> # remove when the RHEL and FC daemon functions converge
> # (pulled from /etc/rc.d/init.d/functions)
> function echo_failure() {
> echo -en "\\033[60G <file:///\\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)
> function echo_success() {
> echo -en "\\033[60G <file:///\\033[60G> "
> echo -n "[ "
> echo -n $"OK"
> echo -n " ]"
> echo -ne "\r"
> return 0
> }
> # 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
> done
> }
> 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-test/* /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 /usr/share/tomcat5-test/*
> ${CATALINA_HOME}/conf/
> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
> cp -pLR /usr/share/tomcat5-test/*
> ${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-test" ];
> 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
> $TOMCAT_RELINK_SCRIPT
> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
> $TOMCAT_LOG 2>&1
> RETVAL="$?"
> if [ "$RETVAL" -eq 0 ]; then
> echo_success
> touch /var/lock/subsys/${NAME}
> else
> echo_failure
> fi
> echo
> return $RETVAL
> }
> function status() {
> RETVAL="1"
> 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})"
> RETVAL="0"
> else
> echo "lock file found but no process running for pid $kpid"
> fi
> else
> pid="$(pgrep -u tomcat java)"
> if [ -n "$pid" ]; then
> echo "$0 running (${pid}) but no PID file exists"
> RETVAL="0"
> else
> echo "$0 is stopped"
> fi
> fi
> return $RETVAL
> }
> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
> fi
> sleep 1
> let count="${count}+1"
> done
> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
> if [ "$STOP_VERBOSE" = "true" ]; then
> 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 -n -e "\n"
> fi
> fi
> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
> else
> echo_failure
> fi
> fi
> }
> # See how we were called.
> case "$1" in
> start)
> parseOptions
> start
> ;;
> stop)
> parseOptions
> stop
> ;;
> restart)
> parseOptions
> stop
> sleep 2
> start
> ;;
> condrestart)
> if [ -f "/var/run/${NAME}.pid" ]; then
> parseOptions
> stop
> start
> fi
> ;;
> status)
> status
> ;;
> version)
> parseOptions
> "${JAVA_HOME}/bin/java" \ -classpath
> "${CATALINA_HOME}/server/lib/catalina.jar" \
> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG
> {start|stop|restart|condrestart|status|version}"
> exit 1
> esac
> exit $RETVAL
>
>
>
> Eduardo Ponce de León
>
> Desarrollador
>
>
>
> Latino Mobile
>
> ---------------------------------------------------
>
> Moliere 450A-101, México D.F.
>
> (T) +5255 -   52 50 65 52
>
> (M)+5255 -   55 06 37 16
>
> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>
> ---------------------------------------------------
>
>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>
> El Mejor Contenido Latino para Móviles
>
>
>
>


---------------------------------------------------------------------
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: ERROR Starting 2nd instance of Tomcat

Posted by Len Popp <le...@gmail.com>.
Where does that "In the config file" come from? It's not in a Tomcat
script, is it?
-- 
Len

On Thu, Aug 28, 2008 at 18:54, Eduardo Ponce de León
<ep...@latinomobile.com.mx> wrote:
>
>
> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
> tomcat folder and modified the server.xml files with different ports. I've
> also created a startup script, but when I run the script I am getting this
> error... Can anyone help please!!
>
> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
> Starting tomcat5-test: [ FAILED ]
>
> This is what i get in my catalina.out
>
> -sh: line 0: export: `In the config file': not a valid identifier
> /bin/bash: /usr/bin/tomcat5-test: Permission denied
> -sh: line 0: export: `In the config file': not a valid identifier
> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>
> This is my startup script... #!/bin/bash # # tomcat5 This shell script takes
> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN INIT
> INFO
> # Provides: tomcat5
> # Required-Start: $network $syslog
> # Required-Stop: $network $syslog
> # Default-Start:
> # Default-Stop:
> # Description: Release implementation for Servlet 2.4 and JSP 2.0
> # Short-Description: start and stop tomcat
> ### END INIT INFO
> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
> # - heavily rewritten by Deepak Bhole and Jason Corley
> # # 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'
> if [ -x "/sbin/runuser" ]; then
> SU="/sbin/runuser"
> else
> SU="su"
> fi
> # Get the tomcat config (use this for environment specific settings)
> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
> if [ -r "$TOMCAT_CFG" ]; then
> . ${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="/usr/bin/tomcat5-test"
> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
> RETVAL="0"
> # remove when the RHEL and FC daemon functions converge
> # (pulled from /etc/rc.d/init.d/functions)
> function checkpid() {
> local i
> for i in $* ; do
> if [ -d "/proc/${i}" ]; then
> return 0
> fi
> done
> return 1
> }
> # remove when the RHEL and FC daemon functions converge
> # (pulled from /etc/rc.d/init.d/functions)
> function echo_failure() {
> echo -en "\\033[60G <file:///\\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)
> function echo_success() {
> echo -en "\\033[60G <file:///\\033[60G> "
> echo -n "[ "
> echo -n $"OK"
> echo -n " ]"
> echo -ne "\r"
> return 0
> }
> # 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
> done
> }
> 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-test/* /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 /usr/share/tomcat5-test/*
> ${CATALINA_HOME}/conf/
> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
> cp -pLR /usr/share/tomcat5-test/*
> ${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-test" ];
> 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
> $TOMCAT_RELINK_SCRIPT
> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
> $TOMCAT_LOG 2>&1
> RETVAL="$?"
> if [ "$RETVAL" -eq 0 ]; then
> echo_success
> touch /var/lock/subsys/${NAME}
> else
> echo_failure
> fi
> echo
> return $RETVAL
> }
> function status() {
> RETVAL="1"
> 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})"
> RETVAL="0"
> else
> echo "lock file found but no process running for pid $kpid"
> fi
> else
> pid="$(pgrep -u tomcat java)"
> if [ -n "$pid" ]; then
> echo "$0 running (${pid}) but no PID file exists"
> RETVAL="0"
> else
> echo "$0 is stopped"
> fi
> fi
> return $RETVAL
> }
> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
> fi
> sleep 1
> let count="${count}+1"
> done
> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
> if [ "$STOP_VERBOSE" = "true" ]; then
> 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 -n -e "\n"
> fi
> fi
> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
> else
> echo_failure
> fi
> fi
> }
> # See how we were called.
> case "$1" in
> start)
> parseOptions
> start
> ;;
> stop)
> parseOptions
> stop
> ;;
> restart)
> parseOptions
> stop
> sleep 2
> start
> ;;
> condrestart)
> if [ -f "/var/run/${NAME}.pid" ]; then
> parseOptions
> stop
> start
> fi
> ;;
> status)
> status
> ;;
> version)
> parseOptions
> "${JAVA_HOME}/bin/java" \ -classpath
> "${CATALINA_HOME}/server/lib/catalina.jar" \
> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG
> {start|stop|restart|condrestart|status|version}"
> exit 1
> esac
> exit $RETVAL
>
>
>
> Eduardo Ponce de León
>
> Desarrollador
>
>
>
> Latino Mobile
>
> ---------------------------------------------------
>
> Moliere 450A-101, México D.F.
>
> (T) +5255 -   52 50 65 52
>
> (M)+5255 -   55 06 37 16
>
> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>
> ---------------------------------------------------
>
>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>
> El Mejor Contenido Latino para Móviles
>
>
>
>

RE: ERROR Starting 2nd instance of Tomcat

Posted by Eduardo Ponce de Leon <ed...@appslm.com>.
I dunno why it is there...this is in my script which calls that config file!

# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG="/etc/tomcat5-test/tomcat5.conf"
if [ -r "$TOMCAT_CFG" ]; then
    . ${TOMCAT_CFG}
fi

-----Original Message-----
From: David Smith [mailto:dns4@cornell.edu] 
Sent: Friday, August 29, 2008 10:08 AM
To: Tomcat Users List
Subject: Re: ERROR Starting 2nd instance of Tomcat

I mean your command line for starting the second tomcat includes the 
phrase 'In the config file'. Why is that there? I doubt it's coincidence 
your error message contains the exact same phrase that you have on the 
command line. It's most likely the source of your problem. 'tomcat5-test 
start' should be more than enough to get the second instance going.

--David

Eduardo Ponce de León wrote:
> I'vedone that to start my second instance! Don’t I need a script to start
it
> up?
>
> Eduardo Ponce de León
> Desarrollador
>  
> Latino Mobile 
> ---------------------------------------------------
> Moliere 450A-101, México D.F.
> (T) +5255 -   52 50 65 52
> (M)+5255 -   55 06 37 16
> (E) rcuesta@latinomobile.com.mx
> ---------------------------------------------------
> www.latinomobile.com.mx
> El Mejor Contenido Latino para Móviles
>
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Thursday, August 28, 2008 11:38 PM
> To: Tomcat Users List
> Subject: Re: ERROR Starting 2nd instance of Tomcat
>
> Ok ... taking a second look at this, why on earth are you using the 
> command 'tomcat5-test start In the config file' to start tomcat?  In 
> particular, 'In the config file' phrase has no place on the command line.
>
> --David
>
> Eduardo Ponce de León wrote:
>   
>>  
>>
>> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
>> tomcat folder and modified the server.xml files with different ports.
I've
>> also created a startup script, but when I run the script I am getting
this
>> error... Can anyone help please!!
>>
>> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
>> Starting tomcat5-test: [ FAILED ] 
>>
>> This is what i get in my catalina.out 
>>
>> -sh: line 0: export: `In the config file': not a valid identifier
>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>> -sh: line 0: export: `In the config file': not a valid identifier
>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>
>> This is my startup script... #!/bin/bash # # tomcat5 This shell script
>>     
> takes
>   
>> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN
>>     
> INIT
>   
>> INFO
>> # Provides: tomcat5
>> # Required-Start: $network $syslog
>> # Required-Stop: $network $syslog
>> # Default-Start:
>> # Default-Stop:
>> # Description: Release implementation for Servlet 2.4 and JSP 2.0
>> # Short-Description: start and stop tomcat
>> ### END INIT INFO
>> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
>> # - heavily rewritten by Deepak Bhole and Jason Corley
>> # # 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'
>> if [ -x "/sbin/runuser" ]; then
>> SU="/sbin/runuser"
>> else
>> SU="su"
>> fi
>> # Get the tomcat config (use this for environment specific settings)
>> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
>> if [ -r "$TOMCAT_CFG" ]; then
>> . ${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="/usr/bin/tomcat5-test"
>> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
>> RETVAL="0"
>> # remove when the RHEL and FC daemon functions converge
>> # (pulled from /etc/rc.d/init.d/functions)
>> function checkpid() {
>> local i
>> for i in $* ; do
>> if [ -d "/proc/${i}" ]; then
>> return 0
>> fi
>> done
>> return 1
>> }
>> # remove when the RHEL and FC daemon functions converge
>> # (pulled from /etc/rc.d/init.d/functions)
>> function echo_failure() {
>> echo -en "\\033[60G <file:///\\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)
>> function echo_success() {
>> echo -en "\\033[60G <file:///\\033[60G> "
>> echo -n "[ "
>> echo -n $"OK"
>> echo -n " ]"
>> echo -ne "\r"
>> return 0
>> }
>> # 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
>> done
>> }
>> 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-test/* /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 /usr/share/tomcat5-test/* 
>> ${CATALINA_HOME}/conf/
>> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
>> cp -pLR /usr/share/tomcat5-test/* 
>> ${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-test" ];
>> 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
>> $TOMCAT_RELINK_SCRIPT
>> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
>> $TOMCAT_LOG 2>&1
>> RETVAL="$?"
>> if [ "$RETVAL" -eq 0 ]; then
>> echo_success
>> touch /var/lock/subsys/${NAME}
>> else
>> echo_failure
>> fi
>> echo
>> return $RETVAL
>> }
>> function status() {
>> RETVAL="1"
>> 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})"
>> RETVAL="0"
>> else
>> echo "lock file found but no process running for pid $kpid"
>> fi
>> else
>> pid="$(pgrep -u tomcat java)"
>> if [ -n "$pid" ]; then
>> echo "$0 running (${pid}) but no PID file exists"
>> RETVAL="0"
>> else
>> echo "$0 is stopped"
>> fi
>> fi
>> return $RETVAL
>> }
>> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
>> fi
>> sleep 1
>> let count="${count}+1"
>> done
>> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
>> if [ "$STOP_VERBOSE" = "true" ]; then
>> 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 -n -e "\n"
>> fi
>> fi
>> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
>> else
>> echo_failure
>> fi
>> fi
>> }
>> # See how we were called.
>> case "$1" in
>> start)
>> parseOptions
>> start
>> ;;
>> stop)
>> parseOptions
>> stop
>> ;;
>> restart)
>> parseOptions
>> stop
>> sleep 2 
>> start
>> ;;
>> condrestart)
>> if [ -f "/var/run/${NAME}.pid" ]; then
>> parseOptions
>> stop
>> start
>> fi
>> ;;
>> status)
>> status
>> ;;
>> version)
>> parseOptions
>> "${JAVA_HOME}/bin/java" \ -classpath
>> "${CATALINA_HOME}/server/lib/catalina.jar" \
>> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
>> {start|stop|restart|condrestart|status|version}"
>> exit 1
>> esac
>> exit $RETVAL
>>
>>  
>>
>> Eduardo Ponce de León
>>
>> Desarrollador
>>
>>  
>>
>> Latino Mobile 
>>
>> ---------------------------------------------------
>>
>> Moliere 450A-101, México D.F.
>>
>> (T) +5255 -   52 50 65 52
>>
>> (M)+5255 -   55 06 37 16
>>
>> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>>
>> ---------------------------------------------------
>>
>>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>>
>> El Mejor Contenido Latino para Móviles
>>
>>  
>>   
>>     
>
>   


---------------------------------------------------------------------
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


__________ Information from ESET Smart Security, version of virus signature
database 3397 (20080828) __________

The message was checked by ESET Smart Security.

http://www.eset.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: ERROR Starting 2nd instance of Tomcat

Posted by David Smith <dn...@cornell.edu>.
Don't edit your profile. Any environment variables needed by tomcat 
should be provided by the service script. Just define them at the top 
before an processing. That isolates the second one from the first.

--David

Eduardo Ponce de Leon wrote:
> David,
> Thanks for the response, that is what I did. I installed a stock version in
> a different directory and customize it. Created a global variable for my
> home directory (in my profile file) but I when I run ./catalina.sh run to
> start it I am getting this error. Any ideas?
>
> [root@balder312 bin]# ./catalina.sh run
> Using CATALINA_BASE: /usr/local/tomcat-test 
> Using CATALINA_HOME_TEST: /usr/local/tomcat-test 
> Using CATALINA_TMPDIR_TEST: /usr/local/tomcat-test/temp 
> Using JRE_HOME: /usr/lib/jvm/java
> WARNING: error instantiating 'org.apache.juli.ClassLoaderLogManager'
> referenced by java.util.logging.manager, class not found
> java.lang.ClassNotFoundException: org.apache.juli.ClassLoaderLogManager not
> found <<No stacktrace available>>
> WARNING: error instantiating '1catalina.org.apache.juli.FileHandler,'
> referenced by handlers, class not found
> java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler,
> <<No stacktrace available>>
> Exception during runtime initialization
> java.lang.ExceptionInInitializerError
> <<No stacktrace available>>
> Caused by: java.lang.NullPointerException <<No stacktrace available>>
>
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Tuesday, September 02, 2008 7:45 AM
> To: Tomcat Users List
> Subject: Re: ERROR Starting 2nd instance of Tomcat
>
> I'm not sure about your install layout at the moment -- whether you 
> installed via a tomcat original distribution or some third party 
> packaged version. If you used a third party package version, undo your 
> efforts to duplicate the first tomcat. Then download, unarchive, and 
> customize the second tomcat in it's own directory. Lastly customize the 
> service scripts for the second one to look at the second one specifically.
>
> --David
>
> Eduardo Ponce de Leon wrote:
>   
>> David,
>> I can´t start the newly stock tomcat version. When I try to start up
>>     
> tomcat
>   
>> by ./catalina.sh run I am getting an error which is pointing to the
>>     
> original
>   
>> tomcat version.. how can I avoid that and just start the instance Ive just
>> installed?
>>
>>
>> -----Original Message-----
>> From: David Smith [mailto:dns4@cornell.edu] 
>> Sent: Friday, August 29, 2008 10:08 AM
>> To: Tomcat Users List
>> Subject: Re: ERROR Starting 2nd instance of Tomcat
>>
>> I mean your command line for starting the second tomcat includes the 
>> phrase 'In the config file'. Why is that there? I doubt it's coincidence 
>> your error message contains the exact same phrase that you have on the 
>> command line. It's most likely the source of your problem. 'tomcat5-test 
>> start' should be more than enough to get the second instance going.
>>
>> --David
>>
>> Eduardo Ponce de León wrote:
>>   
>>     
>>> I'vedone that to start my second instance! Don’t I need a script to start
>>>     
>>>       
>> it
>>   
>>     
>>> up?
>>>
>>> Eduardo Ponce de León
>>> Desarrollador
>>>  
>>> Latino Mobile 
>>> ---------------------------------------------------
>>> Moliere 450A-101, México D.F.
>>> (T) +5255 -   52 50 65 52
>>> (M)+5255 -   55 06 37 16
>>> (E) rcuesta@latinomobile.com.mx
>>> ---------------------------------------------------
>>> www.latinomobile.com.mx
>>> El Mejor Contenido Latino para Móviles
>>>
>>> -----Original Message-----
>>> From: David Smith [mailto:dns4@cornell.edu] 
>>> Sent: Thursday, August 28, 2008 11:38 PM
>>> To: Tomcat Users List
>>> Subject: Re: ERROR Starting 2nd instance of Tomcat
>>>
>>> Ok ... taking a second look at this, why on earth are you using the 
>>> command 'tomcat5-test start In the config file' to start tomcat?  In 
>>> particular, 'In the config file' phrase has no place on the command line.
>>>
>>> --David
>>>
>>> Eduardo Ponce de León wrote:
>>>   
>>>     
>>>       
>>>>  
>>>>
>>>> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
>>>> tomcat folder and modified the server.xml files with different ports.
>>>>       
>>>>         
>> I've
>>   
>>     
>>>> also created a startup script, but when I run the script I am getting
>>>>       
>>>>         
>> this
>>   
>>     
>>>> error... Can anyone help please!!
>>>>
>>>> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
>>>> Starting tomcat5-test: [ FAILED ] 
>>>>
>>>> This is what i get in my catalina.out 
>>>>
>>>> -sh: line 0: export: `In the config file': not a valid identifier
>>>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>>> -sh: line 0: export: `In the config file': not a valid identifier
>>>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>>>
>>>> This is my startup script... #!/bin/bash # # tomcat5 This shell script
>>>>     
>>>>       
>>>>         
>>> takes
>>>   
>>>     
>>>       
>>>> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN
>>>>     
>>>>       
>>>>         
>>> INIT
>>>   
>>>     
>>>       
>>>> INFO
>>>> # Provides: tomcat5
>>>> # Required-Start: $network $syslog
>>>> # Required-Stop: $network $syslog
>>>> # Default-Start:
>>>> # Default-Stop:
>>>> # Description: Release implementation for Servlet 2.4 and JSP 2.0
>>>> # Short-Description: start and stop tomcat
>>>> ### END INIT INFO
>>>> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas
>>>>         
> Mailhot
>   
>>>> # - heavily rewritten by Deepak Bhole and Jason Corley
>>>> # # 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'
>>>> if [ -x "/sbin/runuser" ]; then
>>>> SU="/sbin/runuser"
>>>> else
>>>> SU="su"
>>>> fi
>>>> # Get the tomcat config (use this for environment specific settings)
>>>> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
>>>> if [ -r "$TOMCAT_CFG" ]; then
>>>> . ${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="/usr/bin/tomcat5-test"
>>>> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
>   
>>>> RETVAL="0"
>>>> # remove when the RHEL and FC daemon functions converge
>>>> # (pulled from /etc/rc.d/init.d/functions)
>>>> function checkpid() {
>>>> local i
>>>> for i in $* ; do
>>>> if [ -d "/proc/${i}" ]; then
>>>> return 0
>>>> fi
>>>> done
>>>> return 1
>>>> }
>>>> # remove when the RHEL and FC daemon functions converge
>>>> # (pulled from /etc/rc.d/init.d/functions)
>>>> function echo_failure() {
>>>> echo -en "\\033[60G <file:///\\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)
>>>> function echo_success() {
>>>> echo -en "\\033[60G <file:///\\033[60G> "
>>>> echo -n "[ "
>>>> echo -n $"OK"
>>>> echo -n " ]"
>>>> echo -ne "\r"
>>>> return 0
>>>> }
>>>> # 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
>>>> done
>>>> }
>>>> 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-test/* /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 /usr/share/tomcat5-test/* 
>>>> ${CATALINA_HOME}/conf/
>>>> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
>>>> cp -pLR /usr/share/tomcat5-test/* 
>>>> ${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-test" ];
>>>> 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
>>>> $TOMCAT_RELINK_SCRIPT
>>>> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
>>>> $TOMCAT_LOG 2>&1
>>>> RETVAL="$?"
>>>> if [ "$RETVAL" -eq 0 ]; then
>>>> echo_success
>>>> touch /var/lock/subsys/${NAME}
>>>> else
>>>> echo_failure
>>>> fi
>>>> echo
>>>> return $RETVAL
>>>> }
>>>> function status() {
>>>> RETVAL="1"
>>>> 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})"
>>>> RETVAL="0"
>>>> else
>>>> echo "lock file found but no process running for pid $kpid"
>>>> fi
>>>> else
>>>> pid="$(pgrep -u tomcat java)"
>>>> if [ -n "$pid" ]; then
>>>> echo "$0 running (${pid}) but no PID file exists"
>>>> RETVAL="0"
>>>> else
>>>> echo "$0 is stopped"
>>>> fi
>>>> fi
>>>> return $RETVAL
>>>> }
>>>> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
>>>> fi
>>>> sleep 1
>>>> let count="${count}+1"
>>>> done
>>>> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
>>>> if [ "$STOP_VERBOSE" = "true" ]; then
>>>> 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 -n -e "\n"
>>>> fi
>>>> fi
>>>> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
>>>> else
>>>> echo_failure
>>>> fi
>>>> fi
>>>> }
>>>> # See how we were called.
>>>> case "$1" in
>>>> start)
>>>> parseOptions
>>>> start
>>>> ;;
>>>> stop)
>>>> parseOptions
>>>> stop
>>>> ;;
>>>> restart)
>>>> parseOptions
>>>> stop
>>>> sleep 2 
>>>> start
>>>> ;;
>>>> condrestart)
>>>> if [ -f "/var/run/${NAME}.pid" ]; then
>>>> parseOptions
>>>> stop
>>>> start
>>>> fi
>>>> ;;
>>>> status)
>>>> status
>>>> ;;
>>>> version)
>>>> parseOptions
>>>> "${JAVA_HOME}/bin/java" \ -classpath
>>>> "${CATALINA_HOME}/server/lib/catalina.jar" \
>>>> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
>>>> {start|stop|restart|condrestart|status|version}"
>>>> exit 1
>>>> esac
>>>> exit $RETVAL
>>>>
>>>>  
>>>>
>>>> Eduardo Ponce de León
>>>>
>>>> Desarrollador
>>>>
>>>>  
>>>>
>>>> Latino Mobile 
>>>>
>>>> ---------------------------------------------------
>>>>
>>>> Moliere 450A-101, México D.F.
>>>>
>>>> (T) +5255 -   52 50 65 52
>>>>
>>>> (M)+5255 -   55 06 37 16
>>>>
>>>> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>>>>
>>>> ---------------------------------------------------
>>>>
>>>>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>>>>
>>>> El Mejor Contenido Latino para Móviles
>>>>
>>>>  
>>>>   
>>>>     
>>>>       
>>>>         
>>>   
>>>       


---------------------------------------------------------------------
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: ERROR Starting 2nd instance of Tomcat

Posted by Eduardo Ponce de Leon <ep...@appslm.com>.
David,
Thanks for the response, that is what I did. I installed a stock version in
a different directory and customize it. Created a global variable for my
home directory (in my profile file) but I when I run ./catalina.sh run to
start it I am getting this error. Any ideas?

[root@balder312 bin]# ./catalina.sh run
Using CATALINA_BASE: /usr/local/tomcat-test 
Using CATALINA_HOME_TEST: /usr/local/tomcat-test 
Using CATALINA_TMPDIR_TEST: /usr/local/tomcat-test/temp 
Using JRE_HOME: /usr/lib/jvm/java
WARNING: error instantiating 'org.apache.juli.ClassLoaderLogManager'
referenced by java.util.logging.manager, class not found
java.lang.ClassNotFoundException: org.apache.juli.ClassLoaderLogManager not
found <<No stacktrace available>>
WARNING: error instantiating '1catalina.org.apache.juli.FileHandler,'
referenced by handlers, class not found
java.lang.ClassNotFoundException: 1catalina.org.apache.juli.FileHandler,
<<No stacktrace available>>
Exception during runtime initialization
java.lang.ExceptionInInitializerError
<<No stacktrace available>>
Caused by: java.lang.NullPointerException <<No stacktrace available>>

-----Original Message-----
From: David Smith [mailto:dns4@cornell.edu] 
Sent: Tuesday, September 02, 2008 7:45 AM
To: Tomcat Users List
Subject: Re: ERROR Starting 2nd instance of Tomcat

I'm not sure about your install layout at the moment -- whether you 
installed via a tomcat original distribution or some third party 
packaged version. If you used a third party package version, undo your 
efforts to duplicate the first tomcat. Then download, unarchive, and 
customize the second tomcat in it's own directory. Lastly customize the 
service scripts for the second one to look at the second one specifically.

--David

Eduardo Ponce de Leon wrote:
> David,
> I can´t start the newly stock tomcat version. When I try to start up
tomcat
> by ./catalina.sh run I am getting an error which is pointing to the
original
> tomcat version.. how can I avoid that and just start the instance Ive just
> installed?
>
>
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Friday, August 29, 2008 10:08 AM
> To: Tomcat Users List
> Subject: Re: ERROR Starting 2nd instance of Tomcat
>
> I mean your command line for starting the second tomcat includes the 
> phrase 'In the config file'. Why is that there? I doubt it's coincidence 
> your error message contains the exact same phrase that you have on the 
> command line. It's most likely the source of your problem. 'tomcat5-test 
> start' should be more than enough to get the second instance going.
>
> --David
>
> Eduardo Ponce de León wrote:
>   
>> I'vedone that to start my second instance! Don’t I need a script to start
>>     
> it
>   
>> up?
>>
>> Eduardo Ponce de León
>> Desarrollador
>>  
>> Latino Mobile 
>> ---------------------------------------------------
>> Moliere 450A-101, México D.F.
>> (T) +5255 -   52 50 65 52
>> (M)+5255 -   55 06 37 16
>> (E) rcuesta@latinomobile.com.mx
>> ---------------------------------------------------
>> www.latinomobile.com.mx
>> El Mejor Contenido Latino para Móviles
>>
>> -----Original Message-----
>> From: David Smith [mailto:dns4@cornell.edu] 
>> Sent: Thursday, August 28, 2008 11:38 PM
>> To: Tomcat Users List
>> Subject: Re: ERROR Starting 2nd instance of Tomcat
>>
>> Ok ... taking a second look at this, why on earth are you using the 
>> command 'tomcat5-test start In the config file' to start tomcat?  In 
>> particular, 'In the config file' phrase has no place on the command line.
>>
>> --David
>>
>> Eduardo Ponce de León wrote:
>>   
>>     
>>>  
>>>
>>> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
>>> tomcat folder and modified the server.xml files with different ports.
>>>       
> I've
>   
>>> also created a startup script, but when I run the script I am getting
>>>       
> this
>   
>>> error... Can anyone help please!!
>>>
>>> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
>>> Starting tomcat5-test: [ FAILED ] 
>>>
>>> This is what i get in my catalina.out 
>>>
>>> -sh: line 0: export: `In the config file': not a valid identifier
>>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>> -sh: line 0: export: `In the config file': not a valid identifier
>>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>>
>>> This is my startup script... #!/bin/bash # # tomcat5 This shell script
>>>     
>>>       
>> takes
>>   
>>     
>>> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN
>>>     
>>>       
>> INIT
>>   
>>     
>>> INFO
>>> # Provides: tomcat5
>>> # Required-Start: $network $syslog
>>> # Required-Stop: $network $syslog
>>> # Default-Start:
>>> # Default-Stop:
>>> # Description: Release implementation for Servlet 2.4 and JSP 2.0
>>> # Short-Description: start and stop tomcat
>>> ### END INIT INFO
>>> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas
Mailhot
>>> # - heavily rewritten by Deepak Bhole and Jason Corley
>>> # # 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'
>>> if [ -x "/sbin/runuser" ]; then
>>> SU="/sbin/runuser"
>>> else
>>> SU="su"
>>> fi
>>> # Get the tomcat config (use this for environment specific settings)
>>> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
>>> if [ -r "$TOMCAT_CFG" ]; then
>>> . ${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="/usr/bin/tomcat5-test"
>>> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
>>> RETVAL="0"
>>> # remove when the RHEL and FC daemon functions converge
>>> # (pulled from /etc/rc.d/init.d/functions)
>>> function checkpid() {
>>> local i
>>> for i in $* ; do
>>> if [ -d "/proc/${i}" ]; then
>>> return 0
>>> fi
>>> done
>>> return 1
>>> }
>>> # remove when the RHEL and FC daemon functions converge
>>> # (pulled from /etc/rc.d/init.d/functions)
>>> function echo_failure() {
>>> echo -en "\\033[60G <file:///\\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)
>>> function echo_success() {
>>> echo -en "\\033[60G <file:///\\033[60G> "
>>> echo -n "[ "
>>> echo -n $"OK"
>>> echo -n " ]"
>>> echo -ne "\r"
>>> return 0
>>> }
>>> # 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
>>> done
>>> }
>>> 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-test/* /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 /usr/share/tomcat5-test/* 
>>> ${CATALINA_HOME}/conf/
>>> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
>>> cp -pLR /usr/share/tomcat5-test/* 
>>> ${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-test" ];
>>> 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
>>> $TOMCAT_RELINK_SCRIPT
>>> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
>>> $TOMCAT_LOG 2>&1
>>> RETVAL="$?"
>>> if [ "$RETVAL" -eq 0 ]; then
>>> echo_success
>>> touch /var/lock/subsys/${NAME}
>>> else
>>> echo_failure
>>> fi
>>> echo
>>> return $RETVAL
>>> }
>>> function status() {
>>> RETVAL="1"
>>> 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})"
>>> RETVAL="0"
>>> else
>>> echo "lock file found but no process running for pid $kpid"
>>> fi
>>> else
>>> pid="$(pgrep -u tomcat java)"
>>> if [ -n "$pid" ]; then
>>> echo "$0 running (${pid}) but no PID file exists"
>>> RETVAL="0"
>>> else
>>> echo "$0 is stopped"
>>> fi
>>> fi
>>> return $RETVAL
>>> }
>>> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
>>> fi
>>> sleep 1
>>> let count="${count}+1"
>>> done
>>> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
>>> if [ "$STOP_VERBOSE" = "true" ]; then
>>> 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 -n -e "\n"
>>> fi
>>> fi
>>> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
>>> else
>>> echo_failure
>>> fi
>>> fi
>>> }
>>> # See how we were called.
>>> case "$1" in
>>> start)
>>> parseOptions
>>> start
>>> ;;
>>> stop)
>>> parseOptions
>>> stop
>>> ;;
>>> restart)
>>> parseOptions
>>> stop
>>> sleep 2 
>>> start
>>> ;;
>>> condrestart)
>>> if [ -f "/var/run/${NAME}.pid" ]; then
>>> parseOptions
>>> stop
>>> start
>>> fi
>>> ;;
>>> status)
>>> status
>>> ;;
>>> version)
>>> parseOptions
>>> "${JAVA_HOME}/bin/java" \ -classpath
>>> "${CATALINA_HOME}/server/lib/catalina.jar" \
>>> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
>>> {start|stop|restart|condrestart|status|version}"
>>> exit 1
>>> esac
>>> exit $RETVAL
>>>
>>>  
>>>
>>> Eduardo Ponce de León
>>>
>>> Desarrollador
>>>
>>>  
>>>
>>> Latino Mobile 
>>>
>>> ---------------------------------------------------
>>>
>>> Moliere 450A-101, México D.F.
>>>
>>> (T) +5255 -   52 50 65 52
>>>
>>> (M)+5255 -   55 06 37 16
>>>
>>> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>>>
>>> ---------------------------------------------------
>>>
>>>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>>>
>>> El Mejor Contenido Latino para Móviles
>>>
>>>  
>>>   
>>>     
>>>       
>>   
>>     
>
>
> ---------------------------------------------------------------------
> 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
>
>
> __________ Information from ESET Smart Security, version of virus
signature
> database 3397 (20080828) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.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
>
>   


-- 
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4521


---------------------------------------------------------------------
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


__________ Information from ESET Smart Security, version of virus signature
database 3406 (20080902) __________

The message was checked by ESET Smart Security.

http://www.eset.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: ERROR Starting 2nd instance of Tomcat

Posted by David Smith <dn...@cornell.edu>.
I'm not sure about your install layout at the moment -- whether you 
installed via a tomcat original distribution or some third party 
packaged version. If you used a third party package version, undo your 
efforts to duplicate the first tomcat. Then download, unarchive, and 
customize the second tomcat in it's own directory. Lastly customize the 
service scripts for the second one to look at the second one specifically.

--David

Eduardo Ponce de Leon wrote:
> David,
> I can´t start the newly stock tomcat version. When I try to start up tomcat
> by ./catalina.sh run I am getting an error which is pointing to the original
> tomcat version.. how can I avoid that and just start the instance Ive just
> installed?
>
>
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Friday, August 29, 2008 10:08 AM
> To: Tomcat Users List
> Subject: Re: ERROR Starting 2nd instance of Tomcat
>
> I mean your command line for starting the second tomcat includes the 
> phrase 'In the config file'. Why is that there? I doubt it's coincidence 
> your error message contains the exact same phrase that you have on the 
> command line. It's most likely the source of your problem. 'tomcat5-test 
> start' should be more than enough to get the second instance going.
>
> --David
>
> Eduardo Ponce de León wrote:
>   
>> I'vedone that to start my second instance! Don’t I need a script to start
>>     
> it
>   
>> up?
>>
>> Eduardo Ponce de León
>> Desarrollador
>>  
>> Latino Mobile 
>> ---------------------------------------------------
>> Moliere 450A-101, México D.F.
>> (T) +5255 -   52 50 65 52
>> (M)+5255 -   55 06 37 16
>> (E) rcuesta@latinomobile.com.mx
>> ---------------------------------------------------
>> www.latinomobile.com.mx
>> El Mejor Contenido Latino para Móviles
>>
>> -----Original Message-----
>> From: David Smith [mailto:dns4@cornell.edu] 
>> Sent: Thursday, August 28, 2008 11:38 PM
>> To: Tomcat Users List
>> Subject: Re: ERROR Starting 2nd instance of Tomcat
>>
>> Ok ... taking a second look at this, why on earth are you using the 
>> command 'tomcat5-test start In the config file' to start tomcat?  In 
>> particular, 'In the config file' phrase has no place on the command line.
>>
>> --David
>>
>> Eduardo Ponce de León wrote:
>>   
>>     
>>>  
>>>
>>> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
>>> tomcat folder and modified the server.xml files with different ports.
>>>       
> I've
>   
>>> also created a startup script, but when I run the script I am getting
>>>       
> this
>   
>>> error... Can anyone help please!!
>>>
>>> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
>>> Starting tomcat5-test: [ FAILED ] 
>>>
>>> This is what i get in my catalina.out 
>>>
>>> -sh: line 0: export: `In the config file': not a valid identifier
>>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>> -sh: line 0: export: `In the config file': not a valid identifier
>>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>>
>>> This is my startup script... #!/bin/bash # # tomcat5 This shell script
>>>     
>>>       
>> takes
>>   
>>     
>>> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN
>>>     
>>>       
>> INIT
>>   
>>     
>>> INFO
>>> # Provides: tomcat5
>>> # Required-Start: $network $syslog
>>> # Required-Stop: $network $syslog
>>> # Default-Start:
>>> # Default-Stop:
>>> # Description: Release implementation for Servlet 2.4 and JSP 2.0
>>> # Short-Description: start and stop tomcat
>>> ### END INIT INFO
>>> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
>>> # - heavily rewritten by Deepak Bhole and Jason Corley
>>> # # 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'
>>> if [ -x "/sbin/runuser" ]; then
>>> SU="/sbin/runuser"
>>> else
>>> SU="su"
>>> fi
>>> # Get the tomcat config (use this for environment specific settings)
>>> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
>>> if [ -r "$TOMCAT_CFG" ]; then
>>> . ${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="/usr/bin/tomcat5-test"
>>> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
>>> RETVAL="0"
>>> # remove when the RHEL and FC daemon functions converge
>>> # (pulled from /etc/rc.d/init.d/functions)
>>> function checkpid() {
>>> local i
>>> for i in $* ; do
>>> if [ -d "/proc/${i}" ]; then
>>> return 0
>>> fi
>>> done
>>> return 1
>>> }
>>> # remove when the RHEL and FC daemon functions converge
>>> # (pulled from /etc/rc.d/init.d/functions)
>>> function echo_failure() {
>>> echo -en "\\033[60G <file:///\\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)
>>> function echo_success() {
>>> echo -en "\\033[60G <file:///\\033[60G> "
>>> echo -n "[ "
>>> echo -n $"OK"
>>> echo -n " ]"
>>> echo -ne "\r"
>>> return 0
>>> }
>>> # 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
>>> done
>>> }
>>> 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-test/* /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 /usr/share/tomcat5-test/* 
>>> ${CATALINA_HOME}/conf/
>>> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
>>> cp -pLR /usr/share/tomcat5-test/* 
>>> ${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-test" ];
>>> 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
>>> $TOMCAT_RELINK_SCRIPT
>>> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
>>> $TOMCAT_LOG 2>&1
>>> RETVAL="$?"
>>> if [ "$RETVAL" -eq 0 ]; then
>>> echo_success
>>> touch /var/lock/subsys/${NAME}
>>> else
>>> echo_failure
>>> fi
>>> echo
>>> return $RETVAL
>>> }
>>> function status() {
>>> RETVAL="1"
>>> 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})"
>>> RETVAL="0"
>>> else
>>> echo "lock file found but no process running for pid $kpid"
>>> fi
>>> else
>>> pid="$(pgrep -u tomcat java)"
>>> if [ -n "$pid" ]; then
>>> echo "$0 running (${pid}) but no PID file exists"
>>> RETVAL="0"
>>> else
>>> echo "$0 is stopped"
>>> fi
>>> fi
>>> return $RETVAL
>>> }
>>> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
>>> fi
>>> sleep 1
>>> let count="${count}+1"
>>> done
>>> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
>>> if [ "$STOP_VERBOSE" = "true" ]; then
>>> 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 -n -e "\n"
>>> fi
>>> fi
>>> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
>>> else
>>> echo_failure
>>> fi
>>> fi
>>> }
>>> # See how we were called.
>>> case "$1" in
>>> start)
>>> parseOptions
>>> start
>>> ;;
>>> stop)
>>> parseOptions
>>> stop
>>> ;;
>>> restart)
>>> parseOptions
>>> stop
>>> sleep 2 
>>> start
>>> ;;
>>> condrestart)
>>> if [ -f "/var/run/${NAME}.pid" ]; then
>>> parseOptions
>>> stop
>>> start
>>> fi
>>> ;;
>>> status)
>>> status
>>> ;;
>>> version)
>>> parseOptions
>>> "${JAVA_HOME}/bin/java" \ -classpath
>>> "${CATALINA_HOME}/server/lib/catalina.jar" \
>>> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
>>> {start|stop|restart|condrestart|status|version}"
>>> exit 1
>>> esac
>>> exit $RETVAL
>>>
>>>  
>>>
>>> Eduardo Ponce de León
>>>
>>> Desarrollador
>>>
>>>  
>>>
>>> Latino Mobile 
>>>
>>> ---------------------------------------------------
>>>
>>> Moliere 450A-101, México D.F.
>>>
>>> (T) +5255 -   52 50 65 52
>>>
>>> (M)+5255 -   55 06 37 16
>>>
>>> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>>>
>>> ---------------------------------------------------
>>>
>>>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>>>
>>> El Mejor Contenido Latino para Móviles
>>>
>>>  
>>>   
>>>     
>>>       
>>   
>>     
>
>
> ---------------------------------------------------------------------
> 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
>
>
> __________ Information from ESET Smart Security, version of virus signature
> database 3397 (20080828) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.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
>
>   


-- 
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4521


---------------------------------------------------------------------
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: ERROR Starting 2nd instance of Tomcat

Posted by Eduardo Ponce de Leon <ep...@appslm.com>.
David,
I can´t start the newly stock tomcat version. When I try to start up tomcat
by ./catalina.sh run I am getting an error which is pointing to the original
tomcat version.. how can I avoid that and just start the instance Ive just
installed?


-----Original Message-----
From: David Smith [mailto:dns4@cornell.edu] 
Sent: Friday, August 29, 2008 10:08 AM
To: Tomcat Users List
Subject: Re: ERROR Starting 2nd instance of Tomcat

I mean your command line for starting the second tomcat includes the 
phrase 'In the config file'. Why is that there? I doubt it's coincidence 
your error message contains the exact same phrase that you have on the 
command line. It's most likely the source of your problem. 'tomcat5-test 
start' should be more than enough to get the second instance going.

--David

Eduardo Ponce de León wrote:
> I'vedone that to start my second instance! Don’t I need a script to start
it
> up?
>
> Eduardo Ponce de León
> Desarrollador
>  
> Latino Mobile 
> ---------------------------------------------------
> Moliere 450A-101, México D.F.
> (T) +5255 -   52 50 65 52
> (M)+5255 -   55 06 37 16
> (E) rcuesta@latinomobile.com.mx
> ---------------------------------------------------
> www.latinomobile.com.mx
> El Mejor Contenido Latino para Móviles
>
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Thursday, August 28, 2008 11:38 PM
> To: Tomcat Users List
> Subject: Re: ERROR Starting 2nd instance of Tomcat
>
> Ok ... taking a second look at this, why on earth are you using the 
> command 'tomcat5-test start In the config file' to start tomcat?  In 
> particular, 'In the config file' phrase has no place on the command line.
>
> --David
>
> Eduardo Ponce de León wrote:
>   
>>  
>>
>> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
>> tomcat folder and modified the server.xml files with different ports.
I've
>> also created a startup script, but when I run the script I am getting
this
>> error... Can anyone help please!!
>>
>> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
>> Starting tomcat5-test: [ FAILED ] 
>>
>> This is what i get in my catalina.out 
>>
>> -sh: line 0: export: `In the config file': not a valid identifier
>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>> -sh: line 0: export: `In the config file': not a valid identifier
>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>
>> This is my startup script... #!/bin/bash # # tomcat5 This shell script
>>     
> takes
>   
>> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN
>>     
> INIT
>   
>> INFO
>> # Provides: tomcat5
>> # Required-Start: $network $syslog
>> # Required-Stop: $network $syslog
>> # Default-Start:
>> # Default-Stop:
>> # Description: Release implementation for Servlet 2.4 and JSP 2.0
>> # Short-Description: start and stop tomcat
>> ### END INIT INFO
>> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
>> # - heavily rewritten by Deepak Bhole and Jason Corley
>> # # 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'
>> if [ -x "/sbin/runuser" ]; then
>> SU="/sbin/runuser"
>> else
>> SU="su"
>> fi
>> # Get the tomcat config (use this for environment specific settings)
>> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
>> if [ -r "$TOMCAT_CFG" ]; then
>> . ${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="/usr/bin/tomcat5-test"
>> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
>> RETVAL="0"
>> # remove when the RHEL and FC daemon functions converge
>> # (pulled from /etc/rc.d/init.d/functions)
>> function checkpid() {
>> local i
>> for i in $* ; do
>> if [ -d "/proc/${i}" ]; then
>> return 0
>> fi
>> done
>> return 1
>> }
>> # remove when the RHEL and FC daemon functions converge
>> # (pulled from /etc/rc.d/init.d/functions)
>> function echo_failure() {
>> echo -en "\\033[60G <file:///\\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)
>> function echo_success() {
>> echo -en "\\033[60G <file:///\\033[60G> "
>> echo -n "[ "
>> echo -n $"OK"
>> echo -n " ]"
>> echo -ne "\r"
>> return 0
>> }
>> # 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
>> done
>> }
>> 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-test/* /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 /usr/share/tomcat5-test/* 
>> ${CATALINA_HOME}/conf/
>> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
>> cp -pLR /usr/share/tomcat5-test/* 
>> ${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-test" ];
>> 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
>> $TOMCAT_RELINK_SCRIPT
>> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
>> $TOMCAT_LOG 2>&1
>> RETVAL="$?"
>> if [ "$RETVAL" -eq 0 ]; then
>> echo_success
>> touch /var/lock/subsys/${NAME}
>> else
>> echo_failure
>> fi
>> echo
>> return $RETVAL
>> }
>> function status() {
>> RETVAL="1"
>> 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})"
>> RETVAL="0"
>> else
>> echo "lock file found but no process running for pid $kpid"
>> fi
>> else
>> pid="$(pgrep -u tomcat java)"
>> if [ -n "$pid" ]; then
>> echo "$0 running (${pid}) but no PID file exists"
>> RETVAL="0"
>> else
>> echo "$0 is stopped"
>> fi
>> fi
>> return $RETVAL
>> }
>> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
>> fi
>> sleep 1
>> let count="${count}+1"
>> done
>> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
>> if [ "$STOP_VERBOSE" = "true" ]; then
>> 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 -n -e "\n"
>> fi
>> fi
>> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
>> else
>> echo_failure
>> fi
>> fi
>> }
>> # See how we were called.
>> case "$1" in
>> start)
>> parseOptions
>> start
>> ;;
>> stop)
>> parseOptions
>> stop
>> ;;
>> restart)
>> parseOptions
>> stop
>> sleep 2 
>> start
>> ;;
>> condrestart)
>> if [ -f "/var/run/${NAME}.pid" ]; then
>> parseOptions
>> stop
>> start
>> fi
>> ;;
>> status)
>> status
>> ;;
>> version)
>> parseOptions
>> "${JAVA_HOME}/bin/java" \ -classpath
>> "${CATALINA_HOME}/server/lib/catalina.jar" \
>> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
>> {start|stop|restart|condrestart|status|version}"
>> exit 1
>> esac
>> exit $RETVAL
>>
>>  
>>
>> Eduardo Ponce de León
>>
>> Desarrollador
>>
>>  
>>
>> Latino Mobile 
>>
>> ---------------------------------------------------
>>
>> Moliere 450A-101, México D.F.
>>
>> (T) +5255 -   52 50 65 52
>>
>> (M)+5255 -   55 06 37 16
>>
>> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>>
>> ---------------------------------------------------
>>
>>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>>
>> El Mejor Contenido Latino para Móviles
>>
>>  
>>   
>>     
>
>   


---------------------------------------------------------------------
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


__________ Information from ESET Smart Security, version of virus signature
database 3397 (20080828) __________

The message was checked by ESET Smart Security.

http://www.eset.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: ERROR Starting 2nd instance of Tomcat

Posted by David Smith <dn...@cornell.edu>.
I mean your command line for starting the second tomcat includes the 
phrase 'In the config file'. Why is that there? I doubt it's coincidence 
your error message contains the exact same phrase that you have on the 
command line. It's most likely the source of your problem. 'tomcat5-test 
start' should be more than enough to get the second instance going.

--David

Eduardo Ponce de León wrote:
> I'vedone that to start my second instance! Don’t I need a script to start it
> up?
>
> Eduardo Ponce de León
> Desarrollador
>  
> Latino Mobile 
> ---------------------------------------------------
> Moliere 450A-101, México D.F.
> (T) +5255 -   52 50 65 52
> (M)+5255 -   55 06 37 16
> (E) rcuesta@latinomobile.com.mx
> ---------------------------------------------------
> www.latinomobile.com.mx
> El Mejor Contenido Latino para Móviles
>
> -----Original Message-----
> From: David Smith [mailto:dns4@cornell.edu] 
> Sent: Thursday, August 28, 2008 11:38 PM
> To: Tomcat Users List
> Subject: Re: ERROR Starting 2nd instance of Tomcat
>
> Ok ... taking a second look at this, why on earth are you using the 
> command 'tomcat5-test start In the config file' to start tomcat?  In 
> particular, 'In the config file' phrase has no place on the command line.
>
> --David
>
> Eduardo Ponce de León wrote:
>   
>>  
>>
>> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
>> tomcat folder and modified the server.xml files with different ports. I've
>> also created a startup script, but when I run the script I am getting this
>> error... Can anyone help please!!
>>
>> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
>> Starting tomcat5-test: [ FAILED ] 
>>
>> This is what i get in my catalina.out 
>>
>> -sh: line 0: export: `In the config file': not a valid identifier
>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>> -sh: line 0: export: `In the config file': not a valid identifier
>> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>>
>> This is my startup script... #!/bin/bash # # tomcat5 This shell script
>>     
> takes
>   
>> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN
>>     
> INIT
>   
>> INFO
>> # Provides: tomcat5
>> # Required-Start: $network $syslog
>> # Required-Stop: $network $syslog
>> # Default-Start:
>> # Default-Stop:
>> # Description: Release implementation for Servlet 2.4 and JSP 2.0
>> # Short-Description: start and stop tomcat
>> ### END INIT INFO
>> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
>> # - heavily rewritten by Deepak Bhole and Jason Corley
>> # # 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'
>> if [ -x "/sbin/runuser" ]; then
>> SU="/sbin/runuser"
>> else
>> SU="su"
>> fi
>> # Get the tomcat config (use this for environment specific settings)
>> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
>> if [ -r "$TOMCAT_CFG" ]; then
>> . ${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="/usr/bin/tomcat5-test"
>> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
>> RETVAL="0"
>> # remove when the RHEL and FC daemon functions converge
>> # (pulled from /etc/rc.d/init.d/functions)
>> function checkpid() {
>> local i
>> for i in $* ; do
>> if [ -d "/proc/${i}" ]; then
>> return 0
>> fi
>> done
>> return 1
>> }
>> # remove when the RHEL and FC daemon functions converge
>> # (pulled from /etc/rc.d/init.d/functions)
>> function echo_failure() {
>> echo -en "\\033[60G <file:///\\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)
>> function echo_success() {
>> echo -en "\\033[60G <file:///\\033[60G> "
>> echo -n "[ "
>> echo -n $"OK"
>> echo -n " ]"
>> echo -ne "\r"
>> return 0
>> }
>> # 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
>> done
>> }
>> 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-test/* /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 /usr/share/tomcat5-test/* 
>> ${CATALINA_HOME}/conf/
>> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
>> cp -pLR /usr/share/tomcat5-test/* 
>> ${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-test" ];
>> 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
>> $TOMCAT_RELINK_SCRIPT
>> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
>> $TOMCAT_LOG 2>&1
>> RETVAL="$?"
>> if [ "$RETVAL" -eq 0 ]; then
>> echo_success
>> touch /var/lock/subsys/${NAME}
>> else
>> echo_failure
>> fi
>> echo
>> return $RETVAL
>> }
>> function status() {
>> RETVAL="1"
>> 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})"
>> RETVAL="0"
>> else
>> echo "lock file found but no process running for pid $kpid"
>> fi
>> else
>> pid="$(pgrep -u tomcat java)"
>> if [ -n "$pid" ]; then
>> echo "$0 running (${pid}) but no PID file exists"
>> RETVAL="0"
>> else
>> echo "$0 is stopped"
>> fi
>> fi
>> return $RETVAL
>> }
>> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
>> fi
>> sleep 1
>> let count="${count}+1"
>> done
>> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
>> if [ "$STOP_VERBOSE" = "true" ]; then
>> 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 -n -e "\n"
>> fi
>> fi
>> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
>> else
>> echo_failure
>> fi
>> fi
>> }
>> # See how we were called.
>> case "$1" in
>> start)
>> parseOptions
>> start
>> ;;
>> stop)
>> parseOptions
>> stop
>> ;;
>> restart)
>> parseOptions
>> stop
>> sleep 2 
>> start
>> ;;
>> condrestart)
>> if [ -f "/var/run/${NAME}.pid" ]; then
>> parseOptions
>> stop
>> start
>> fi
>> ;;
>> status)
>> status
>> ;;
>> version)
>> parseOptions
>> "${JAVA_HOME}/bin/java" \ -classpath
>> "${CATALINA_HOME}/server/lib/catalina.jar" \
>> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
>> {start|stop|restart|condrestart|status|version}"
>> exit 1
>> esac
>> exit $RETVAL
>>
>>  
>>
>> Eduardo Ponce de León
>>
>> Desarrollador
>>
>>  
>>
>> Latino Mobile 
>>
>> ---------------------------------------------------
>>
>> Moliere 450A-101, México D.F.
>>
>> (T) +5255 -   52 50 65 52
>>
>> (M)+5255 -   55 06 37 16
>>
>> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>>
>> ---------------------------------------------------
>>
>>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>>
>> El Mejor Contenido Latino para Móviles
>>
>>  
>>   
>>     
>
>   


---------------------------------------------------------------------
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: ERROR Starting 2nd instance of Tomcat

Posted by Eduardo Ponce de León <ep...@latinomobile.com.mx>.
I'vedone that to start my second instance! Don’t I need a script to start it
up?

Eduardo Ponce de León
Desarrollador
 
Latino Mobile 
---------------------------------------------------
Moliere 450A-101, México D.F.
(T) +5255 -   52 50 65 52
(M)+5255 -   55 06 37 16
(E) rcuesta@latinomobile.com.mx
---------------------------------------------------
www.latinomobile.com.mx
El Mejor Contenido Latino para Móviles

-----Original Message-----
From: David Smith [mailto:dns4@cornell.edu] 
Sent: Thursday, August 28, 2008 11:38 PM
To: Tomcat Users List
Subject: Re: ERROR Starting 2nd instance of Tomcat

Ok ... taking a second look at this, why on earth are you using the 
command 'tomcat5-test start In the config file' to start tomcat?  In 
particular, 'In the config file' phrase has no place on the command line.

--David

Eduardo Ponce de León wrote:
>  
>
> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
> tomcat folder and modified the server.xml files with different ports. I've
> also created a startup script, but when I run the script I am getting this
> error... Can anyone help please!!
>
> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
> Starting tomcat5-test: [ FAILED ] 
>
> This is what i get in my catalina.out 
>
> -sh: line 0: export: `In the config file': not a valid identifier
> /bin/bash: /usr/bin/tomcat5-test: Permission denied
> -sh: line 0: export: `In the config file': not a valid identifier
> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>
> This is my startup script... #!/bin/bash # # tomcat5 This shell script
takes
> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN
INIT
> INFO
> # Provides: tomcat5
> # Required-Start: $network $syslog
> # Required-Stop: $network $syslog
> # Default-Start:
> # Default-Stop:
> # Description: Release implementation for Servlet 2.4 and JSP 2.0
> # Short-Description: start and stop tomcat
> ### END INIT INFO
> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
> # - heavily rewritten by Deepak Bhole and Jason Corley
> # # 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'
> if [ -x "/sbin/runuser" ]; then
> SU="/sbin/runuser"
> else
> SU="su"
> fi
> # Get the tomcat config (use this for environment specific settings)
> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
> if [ -r "$TOMCAT_CFG" ]; then
> . ${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="/usr/bin/tomcat5-test"
> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
> RETVAL="0"
> # remove when the RHEL and FC daemon functions converge
> # (pulled from /etc/rc.d/init.d/functions)
> function checkpid() {
> local i
> for i in $* ; do
> if [ -d "/proc/${i}" ]; then
> return 0
> fi
> done
> return 1
> }
> # remove when the RHEL and FC daemon functions converge
> # (pulled from /etc/rc.d/init.d/functions)
> function echo_failure() {
> echo -en "\\033[60G <file:///\\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)
> function echo_success() {
> echo -en "\\033[60G <file:///\\033[60G> "
> echo -n "[ "
> echo -n $"OK"
> echo -n " ]"
> echo -ne "\r"
> return 0
> }
> # 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
> done
> }
> 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-test/* /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 /usr/share/tomcat5-test/* 
> ${CATALINA_HOME}/conf/
> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
> cp -pLR /usr/share/tomcat5-test/* 
> ${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-test" ];
> 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
> $TOMCAT_RELINK_SCRIPT
> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
> $TOMCAT_LOG 2>&1
> RETVAL="$?"
> if [ "$RETVAL" -eq 0 ]; then
> echo_success
> touch /var/lock/subsys/${NAME}
> else
> echo_failure
> fi
> echo
> return $RETVAL
> }
> function status() {
> RETVAL="1"
> 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})"
> RETVAL="0"
> else
> echo "lock file found but no process running for pid $kpid"
> fi
> else
> pid="$(pgrep -u tomcat java)"
> if [ -n "$pid" ]; then
> echo "$0 running (${pid}) but no PID file exists"
> RETVAL="0"
> else
> echo "$0 is stopped"
> fi
> fi
> return $RETVAL
> }
> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
> fi
> sleep 1
> let count="${count}+1"
> done
> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
> if [ "$STOP_VERBOSE" = "true" ]; then
> 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 -n -e "\n"
> fi
> fi
> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
> else
> echo_failure
> fi
> fi
> }
> # See how we were called.
> case "$1" in
> start)
> parseOptions
> start
> ;;
> stop)
> parseOptions
> stop
> ;;
> restart)
> parseOptions
> stop
> sleep 2 
> start
> ;;
> condrestart)
> if [ -f "/var/run/${NAME}.pid" ]; then
> parseOptions
> stop
> start
> fi
> ;;
> status)
> status
> ;;
> version)
> parseOptions
> "${JAVA_HOME}/bin/java" \ -classpath
> "${CATALINA_HOME}/server/lib/catalina.jar" \
> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
> {start|stop|restart|condrestart|status|version}"
> exit 1
> esac
> exit $RETVAL
>
>  
>
> Eduardo Ponce de León
>
> Desarrollador
>
>  
>
> Latino Mobile 
>
> ---------------------------------------------------
>
> Moliere 450A-101, México D.F.
>
> (T) +5255 -   52 50 65 52
>
> (M)+5255 -   55 06 37 16
>
> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>
> ---------------------------------------------------
>
>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>
> El Mejor Contenido Latino para Móviles
>
>  
>   


---------------------------------------------------------------------
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



__________ Information from ESET Smart Security, version of virus signature
database 3397 (20080828) __________

The message was checked by ESET Smart Security.

http://www.eset.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: ERROR Starting 2nd instance of Tomcat

Posted by David Smith <dn...@cornell.edu>.
Ok ... taking a second look at this, why on earth are you using the 
command 'tomcat5-test start In the config file' to start tomcat?  In 
particular, 'In the config file' phrase has no place on the command line.

--David

Eduardo Ponce de León wrote:
>  
>
> I am trying to run a 2nd instace of tomcat. For this, ive duplicated the
> tomcat folder and modified the server.xml files with different ports. I've
> also created a startup script, but when I run the script I am getting this
> error... Can anyone help please!!
>
> [root@balder312 tomcat5-test]# tomcat5-test start In the config file
> Starting tomcat5-test: [ FAILED ] 
>
> This is what i get in my catalina.out 
>
> -sh: line 0: export: `In the config file': not a valid identifier
> /bin/bash: /usr/bin/tomcat5-test: Permission denied
> -sh: line 0: export: `In the config file': not a valid identifier
> /bin/bash: /usr/bin/tomcat5-test: Permission denied
>
> This is my startup script... #!/bin/bash # # tomcat5 This shell script takes
> care of starting and stopping Tomcat # # chkconfig: - 80 20 # ### BEGIN INIT
> INFO
> # Provides: tomcat5
> # Required-Start: $network $syslog
> # Required-Stop: $network $syslog
> # Default-Start:
> # Default-Stop:
> # Description: Release implementation for Servlet 2.4 and JSP 2.0
> # Short-Description: start and stop tomcat
> ### END INIT INFO
> # # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
> # - heavily rewritten by Deepak Bhole and Jason Corley
> # # 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'
> if [ -x "/sbin/runuser" ]; then
> SU="/sbin/runuser"
> else
> SU="su"
> fi
> # Get the tomcat config (use this for environment specific settings)
> TOMCAT_CFG="/etc/tomcat5/tomcat5.conf"
> if [ -r "$TOMCAT_CFG" ]; then
> . ${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="/usr/bin/tomcat5-test"
> # 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:-/usr/share/tomcat5-test/logs/logscatalina.out}"
> RETVAL="0"
> # remove when the RHEL and FC daemon functions converge
> # (pulled from /etc/rc.d/init.d/functions)
> function checkpid() {
> local i
> for i in $* ; do
> if [ -d "/proc/${i}" ]; then
> return 0
> fi
> done
> return 1
> }
> # remove when the RHEL and FC daemon functions converge
> # (pulled from /etc/rc.d/init.d/functions)
> function echo_failure() {
> echo -en "\\033[60G <file:///\\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)
> function echo_success() {
> echo -en "\\033[60G <file:///\\033[60G> "
> echo -n "[ "
> echo -n $"OK"
> echo -n " ]"
> echo -ne "\r"
> return 0
> }
> # 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
> done
> }
> 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-test/* /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 /usr/share/tomcat5-test/* 
> ${CATALINA_HOME}/conf/
> cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
> cp -pLR /usr/share/tomcat5-test/* 
> ${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-test" ];
> 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
> $TOMCAT_RELINK_SCRIPT
> $SU - $TOMCAT_USER -c "$TOMCAT_SCRIPT start" >>
> $TOMCAT_LOG 2>&1
> RETVAL="$?"
> if [ "$RETVAL" -eq 0 ]; then
> echo_success
> touch /var/lock/subsys/${NAME}
> else
> echo_failure
> fi
> echo
> return $RETVAL
> }
> function status() {
> RETVAL="1"
> 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})"
> RETVAL="0"
> else
> echo "lock file found but no process running for pid $kpid"
> fi
> else
> pid="$(pgrep -u tomcat java)"
> if [ -n "$pid" ]; then
> echo "$0 running (${pid}) but no PID file exists"
> RETVAL="0"
> else
> echo "$0 is stopped"
> fi
> fi
> return $RETVAL
> }
> 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 "/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 -n -e "\nwaiting for processes $kpid to exit"
> fi
> sleep 1
> let count="${count}+1"
> done
> if [ "$count" -gt "$SHUTDOWN_WAIT" ]; then
> if [ "$STOP_VERBOSE" = "true" ]; then
> 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 -n -e "\n"
> fi
> fi
> rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
> else
> echo_failure
> fi
> fi
> }
> # See how we were called.
> case "$1" in
> start)
> parseOptions
> start
> ;;
> stop)
> parseOptions
> stop
> ;;
> restart)
> parseOptions
> stop
> sleep 2 
> start
> ;;
> condrestart)
> if [ -f "/var/run/${NAME}.pid" ]; then
> parseOptions
> stop
> start
> fi
> ;;
> status)
> status
> ;;
> version)
> parseOptions
> "${JAVA_HOME}/bin/java" \ -classpath
> "${CATALINA_HOME}/server/lib/catalina.jar" \
> org.apache.catalina.util.ServerInfo ;; *) echo "Usage: $TOMCAT_PROG 
> {start|stop|restart|condrestart|status|version}"
> exit 1
> esac
> exit $RETVAL
>
>  
>
> Eduardo Ponce de León
>
> Desarrollador
>
>  
>
> Latino Mobile 
>
> ---------------------------------------------------
>
> Moliere 450A-101, México D.F.
>
> (T) +5255 -   52 50 65 52
>
> (M)+5255 -   55 06 37 16
>
> (E)  <ma...@latinomobile.com.mx> rcuesta@latinomobile.com.mx
>
> ---------------------------------------------------
>
>  <http://www.latinomobile.com.mx/> www.latinomobile.com.mx
>
> El Mejor Contenido Latino para Móviles
>
>  
>   


---------------------------------------------------------------------
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