You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kamaleshwaran Sivalingam <ka...@rediffmail.com> on 2004/07/16 21:15:59 UTC
Problem with startup script for tomcat in linux
Hi all,
I have a problem using startup script for tomcat in linux. It actually starts
up when booting up. but then, it says " [Failed] " and the reason is
"JAVA_HOME variable not defined correctly. This environment variable is
neccesary for running this program. "
But I have defined the environment variable in my startup script.
I am using Tomcat 4.1.18 with j2sdk1.4.1_02 in redhat linux.
tomcat directory is /usr/local/jakarta-tomcat-4.1.18 and the java directory is /usr/
java/j2sdk1.4.1_02
I placed the startup script named tomcatd.sh in "/etc/rc.d/init.d"
The following is my startup script.
#!/bin/bash
#
# Startup script for Jakarta Tomcat
#
# chkconfig: 345 84 16
# description: Jakarta Tomcat Java Servlet/JSP Container
TOMCAT_HOME=/usr/local/jakarta-tomcat-4.1.18
TOMCAT_START=/usr/local/jakarta-tomcat-4.1.18/bin/startup.sh
TOMCAT_STOP=/usr/local/jakarta-tomcat-4.1.18/bin/shutdown.sh
#Necessary environment variables
export CATALINA_HOME=/usr/local/jakarta-tomcat-4.1.18
export JAVA_HOME=/usr/java/jdk1.4.1_02
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
#Check for tomcat script
if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]
then
echo "Tomcat not available..."
exit
fi
start() {
echo -n "Starting Tomcat: "
daemon $TOMCAT_START
echo
touch /var/lock/subsys/tomcatd
# We may need to sleep here so it will be up for apache
# sleep 5
#Instead should check to see if apache is up by looking for http.pid
}
stop() {
echo -n $"Shutting down Tomcat: "
daemon $TOMCAT_STOP
rm -f /var/lock/subsys/tomcatd.pid
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo "Usage: tomcatd {start|stop|restart}"
exit 1
esac
Can anyone help me out?.
Thanks in advance,
kamaleshwaran sivalingam
Re: Problem with startup script for tomcat in linux
Posted by David Smith <dn...@cornell.edu>.
Typo in your script. the JAVA_HOME line should read:
JAVA_HOME=/usr/java/j2sdk1.4.1_02
--David
Kamaleshwaran Sivalingam wrote:
> Hi all,
>
> I have a problem using startup script for tomcat in linux. It actually starts
>up when booting up. but then, it says " [Failed] " and the reason is
>"JAVA_HOME variable not defined correctly. This environment variable is
>neccesary for running this program. "
>
>But I have defined the environment variable in my startup script.
>
>I am using Tomcat 4.1.18 with j2sdk1.4.1_02 in redhat linux.
>tomcat directory is /usr/local/jakarta-tomcat-4.1.18 and the java directory is /usr/
>java/j2sdk1.4.1_02
>
>I placed the startup script named tomcatd.sh in "/etc/rc.d/init.d"
>
>The following is my startup script.
>
>#!/bin/bash
>#
># Startup script for Jakarta Tomcat
>#
># chkconfig: 345 84 16
># description: Jakarta Tomcat Java Servlet/JSP Container
>
>
>
>TOMCAT_HOME=/usr/local/jakarta-tomcat-4.1.18
>TOMCAT_START=/usr/local/jakarta-tomcat-4.1.18/bin/startup.sh
>TOMCAT_STOP=/usr/local/jakarta-tomcat-4.1.18/bin/shutdown.sh
>
>#Necessary environment variables
>export CATALINA_HOME=/usr/local/jakarta-tomcat-4.1.18
>export JAVA_HOME=/usr/java/jdk1.4.1_02
>
># Source function library.
>. /etc/rc.d/init.d/functions
>
># Source networking configuration.
>. /etc/sysconfig/network
>
># Check that networking is up.
>[ ${NETWORKING} = "no" ] && exit 0
>
>#Check for tomcat script
>if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]
>then
> echo "Tomcat not available..."
> exit
>fi
>
>start() {
> echo -n "Starting Tomcat: "
> daemon $TOMCAT_START
> echo
> touch /var/lock/subsys/tomcatd
># We may need to sleep here so it will be up for apache
># sleep 5
>#Instead should check to see if apache is up by looking for http.pid
>}
>
>stop() {
> echo -n $"Shutting down Tomcat: "
> daemon $TOMCAT_STOP
> rm -f /var/lock/subsys/tomcatd.pid
> echo
>}
>
>case "$1" in
> start)
> start
> ;;
> stop)
> stop
> ;;
> restart)
> stop
> sleep 3
> start
> ;;
> *)
> echo "Usage: tomcatd {start|stop|restart}"
> exit 1
>esac
>
>Can anyone help me out?.
>
>Thanks in advance,
>kamaleshwaran sivalingam
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org