tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin HaleBoyes <kcbo...@yahoo.com>
Subject Re: Automatic start from /etc/rc3.d ???
Date Thu, 06 Jun 2002 19:22:50 GMT
The original message is at the end...

I'm using RedHat linux but I suspect the solution is very similar.

I've created a user tomcat4 in the already existing apache group.
Login is disabled for this user for security reasons.  The
jakarta-tomcat-4.0.3 directory is owned by root with 777 perms
on the work and logs subdirectories.  On further thought I suppose
I could have chown'd those directories to tomcat4.apache with 755
perms.

I've created a file /etc/sysconfig/tomcat4 as follows:

-------------%<--------------------------------------
export JAVA_HOME=/usr/java/j2sdk1.4.0

export CATALINA_BASE=/usr/local/jakarta/jakarta-tomcat-4.0.3
export CATALINA_HOME=$CATALINA_BASE
-------------%<--------------------------------------

This gets referenced/sourced in the init script which is
named /etc/rc.d/init.d/tomcat4.  It is heavily based on
the httpd init script.  It doesn't do status yet and the locking
hasn't been tested but it seems to work ok otherwise.

I then run 'chkconfig --add tomcat4' to install it in the proper
runlevel directories.  There may also be a problem with the
order on shutdown but I'm not sure.  I think I might be trying
to shutdown postgresql before tomcat which ends up blocking, so
the shutdown fails.  At least, I think that is what happens.  YMMV.

I ask one favour.  If you improve upon this script then please post
your changes as there has been a real lack of this sort of tomcat
infrastructure postings.  Now, I'm just as guilty since I meant to
post this long ago but ended up forgetting...

Kevin

-------------%<--------------------------------------
#!/bin/bash
#
# Startup script for the Apache Tomcat JSP/Servlet Container
#
# chkconfig: 345 85 15
# description: Apache Tomcat is a JSP/Servlet container.  It is used to serve \
#              JSP pages and "execute" servlets.
# processname: XXX - fixme - XXX
# pidfile: none
# lockfile: /var/lock/subsys/tomcat4
# config: $CATALINA_HOME/conf/server.xml
# config: /etc/sysconfig/tomcat4

# Source function library.
. /etc/rc.d/init.d/functions

# Source additional OPTIONS if we have them.
if [ -f /etc/sysconfig/tomcat4 ] ; then
    . /etc/sysconfig/tomcat4
fi

prog=tomcat4

start() {
    echo -n $"Starting $prog: "
    #daemon $httpd `moduleargs` $OPTIONS
    su tomcat4 ${CATALINA_HOME}/bin/catalina.sh start $2>&1
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && touch /var/lock/subsys/tomcat4
    return $RETVAL
}
stop() {
    echo -n $"Stopping $prog: "
    #killproc $httpd
    su tomcat4 ${CATALINA_HOME}/bin/catalina.sh stop $2>&1
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/tomcat4 /var/run/tomcat4.pid
}
status() {
    echo -n $"Status $prog: not implemented yet!"
    echo
    RETVAL=1
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    sleep 20
    start
    ;;
  *)
    echo $"Usage: $prog {start|stop|restart}"
    exit 1
esac

exit $RETVAL

-------------%<--------------------------------------



Original message follows:
--------------------------------------------------------------------
Hi all,

Using SOLARIS 2.8, Tomcat 4.0.2 on a SUN 220R Server

Well my Tomcat engine is runnin' under a special user, let's say
wildcat.

I'm  looking for a way to automatically start this engine at system
boot, like i do with Apache.

Apache has a special way - start by root and change user to handle the
processes - to do the trick, but not Tomcat.

Does any one knows about a restriction to use smth like su wildtiger -c
'$TOMCAT_HOME/bin/startup.sh'...

Any suggestions welcome.

Jean-Luc :O)




__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message