Page 1 of 1
Tomcat Init Script on SuSE 9.3
Posted: Mon Aug 29, 2005 11:00 am
by thejoker101
There is a tomcat init script in admin_resource_kit, however it is written for RedHat.
Anyone know how I should modify it to get it to work in SuSE 9.3? I put it in /etc/init.d/, but it couldn't find some functions it needs, located at: . /etc/init.d/functions.
Posted: Mon Aug 29, 2005 12:41 pm
by ScalixSupport
We made some changes for the next release so please apply this script and report back the results.
Cheers
Dave
Code: Select all
#!/bin/sh
#
# chkconfig: 345 91 10
#
# description: \
# This is the init script for starting up the Jakarta Tomcat server.
#
# To install this script on a RedHat or SuSE Linux system, follow these steps:
#
# (1) log in as root
# (2) copy this script to /etc/init.d
# (3) enter "chmod 755 /etc/init.d/scalix-tomcat"
# (4) edit the script using vi or your favorite editor and ensure that
# CATALINA_HOME points to the location of your Tomcat 4 or 5 (or later)
# directory
# (5) enter "chkconfig --add scalix-tomcat"
#
# Tomcat will now be configured to start as a system service when the
# machine boots.
#
# (6) enter "/etc/init.d/scalix-tomcat start" to manually start Tomcat and
# "/etc/init.d/scalix-tomcat stop" to manually stop Tomcat.
#
###### !! PLEASE CHANGE THE FOLLOWING 3 LINES TO MATCH YOUR ENVIRONMENT !! ######
CATALINA_HOME="/home/jakarta-tomcat-5.0.19"
###### !! YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW HERE !! ######
export CATALINA_HOME
# you do not need to change anything below here
# detect the distribution:
if [ -f /etc/redhat-release -o -f /etc/fedora-release ] ; then
DISTRIBUTION="redhat"
elif [ -f /etc/SuSE-release ] ; then
DISTRIBUTION="suse"
else
echo "Error: unsupported distribution" >&2
exit 1
fi
# Source function library.
[ "$DISTRIBUTION" = "redhat" ] && . /etc/init.d/functions
[ "$DISTRIBUTION" = "suse" ] && . /etc/rc.status
# test if network is up (redhat-only):
if [ "$DISTRIBUTION" = "redhat" ] ; then
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
fi
startup=$CATALINA_HOME/bin/startup.sh
shutdown=$CATALINA_HOME/bin/shutdown.sh
# Where the Scalix server admin commands live (for Scalix server installed locally)
PATH=$PATH:/opt/scalix/bin; export PATH
# Functions
if [ "$DISTRIBUTION" = "redhat" ] ; then
start() {
action $"Starting Tomcat service: " $startup
RETVAL=$?
}
stop() {
action $"Stopping Tomcat service: " $shutdown
RETVAL=$?
}
elif [ "$DISTRIBUTION" = "suse" ] ; then
start() {
echo -n "Starting Tomcat service"
$startup
rc_status -v
}
stop() {
echo -n "Stoppping Tomcat service"
$shutdown
rc_status -v
}
fi
restart() {
stop
start
}
[ "$DISTRIBUTION" = "suse" ] && rc_reset
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
[ "$DISTRIBUTION" = "suse" ] && rc_exit
exit 0
Posted: Mon Aug 29, 2005 1:37 pm
by thejoker101
That seems to have worked, though I think I have a problem with my tomcat. Here is the output from testing the start/stop after installing that script.
Code: Select all
linux:/etc/init.d # ./tomcat stop
Stoppping Tomcat serviceUsing CATALINA_BASE: /opt/tomcat/jakarta-tomcat-5.5.9
Using CATALINA_HOME: /opt/tomcat/jakarta-tomcat-5.5.9
Using CATALINA_TMPDIR: /opt/tomcat/jakarta-tomcat-5.5.9/temp
Using JRE_HOME: /usr/lib/jvm/java/jre
This release of Apache Tomcat was packaged to run on J2SE 5.0
or later. It can be run on earlier JVMs by downloading and
installing a compatibility package from the Apache Tomcat
binary download page.
done
linux:/etc/init.d # ./tomcat start
Starting Tomcat serviceUsing CATALINA_BASE: /opt/tomcat/jakarta-tomcat-5.5.9
Using CATALINA_HOME: /opt/tomcat/jakarta-tomcat-5.5.9
Using CATALINA_TMPDIR: /opt/tomcat/jakarta-tomcat-5.5.9/temp
Using JRE_HOME: /usr/lib/jvm/java/jre
done
linux:/etc/init.d #
Posted: Mon Aug 29, 2005 1:56 pm
by thejoker101
Uninstalled Tomcat 5.5 and reinstalled tomcat 5.0 and that seemed to fix that.
I still don't have it up and working though. :(
Posted: Fri Sep 09, 2005 4:13 am
by hermanig
thx for the Script
I´m using Suse Prof. 9.3 and works fine
Posted: Tue Sep 13, 2005 11:05 pm
by Obdobion
I used the script on suse 9.3 and it worked great! Thanks.
Posted: Wed Sep 14, 2005 2:46 am
by constant
.
Just to make it three strikes and your a winner, it works for me too.
Only one small difference, I called my file "tomcat", as I had already setup the service in Yast when I installed script part one. It still works perfectly.
Nice touch with the info about directories used as the service starts.
Regards
J.D.