You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Roberto B." <ro...@ipermedianet.com> on 2001/08/20 15:47:27 UTC
Script for automatic startup of Tomcat
I found in this list the following script to automatically startup Tomcat at
boot time..
------------------------------------------------------------------
#! /bin/sh
# Init file for Jakarta Tomcat
#
# chkconfig: 345 98 00
# description: Jakarta Tomcat daemon
#
# processname:
# config: /usr/tomcat4b6/conf/server.xml
RETVAL=0
CATALINA_HOME=/usr/tomcat4b6
export CATALINA_HOME
case "$1" in
start)
F=`$0 status`
if [ "$?" = "255" ] ; then
echo -n "Starting Tomcat : "
su - root -c "cd $CATALINA_HOME/bin; $CATALINA_HOME/bin/startup.sh >
$CATALINA_HOME/logs/tomcat_stdout.log 2>
$CATALINA_HOME/logs/tomcat_stderr.log"
echo " [OK] "
else
echo "Tomcat is already running."
fi
echo
;;
stop)
F=`$0 status`
if [ "$?" = "255" ] ; then
echo -n "Tomcat isn't running "
else
echo -n "Shutting down Tomcat : "
su - root -c "cd $CATALINA_HOME/bin; $CATALINA_HOME/bin/shutdown.sh >
$CATALINA_HOME/logs/tomcat_down_stdout.log 2>
$CATALINA_HOME/logs/tomcat_down_stderr.log"
echo " [OK] "
fi
echo
;;
restart)
$0 stop
sleep 2
$0 start
RETVAL=$?
;;
status)
S=`ps auxww | grep org.apache.tomcat.startup.Tomcat | wc -l`
E=`expr $S`
if [ "$E" = "0" ] ; then
echo "Tomcat is stopped"
RETVAL=-1
else
PIDS=`ps auxww | grep org.apache.tomcat.startup.Tomcat | awk '{FS="
"}{print $2}'`
P=`echo $PIDS`
echo "Tomcat ($P) is running"
RETVAL=0
fi
;;
*)
echo "Usage: tomcat {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
-----------------------------------------------------------------------
.... but it seems that it doesn't work, infact at boot time of the system i
receive the message:
Tomcat is already running.
Maybe the part of the status (...ps auxww | grep
org.apache.tomcat.startup.Tomcat...) is wrong?