tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Cassidy <dcass...@hotgen.com>
Subject Re: Why and How Tomcat before Apache?
Date Fri, 17 Aug 2001 15:06:12 GMT
Ah what the hell try this ...
( works for me !)


Watch out for the line wraps !


------------- 8< -- snip 
#!/bin/sh

# Init file for Jakarta Tomcat
#
# chkconfig: 345 98 00
# description: Jakarta tomcat daemon
#
# processname: 
# config: /usr/local/tomcat/conf/server.xml

RETVAL=0

TOMCAT_HOME=/usr/local/tomcat
export TOMCAT_HOME

case "$1" in
  start)
        F=`$0 status`
        if [ "$?" = "255" ] ; then
                echo -n "Starting Tomcat : "
                su - tomcat -c "cd $TOMCAT_HOME/bin;
$TOMCAT_HOME/bin/startup.sh > $TOMCAT_HOME/logs/tomcat_stdout.log 2>
$TOMCAT_HOME/logs/tomcat_stderr.log"
                echo "                                  [ OK ] "
        else
                echo "Tomcat is already running"
        fi
        echo
        ;;
  stop)
        F=`$0 status`
        if [ "$?" = "255" ] ; then
                echo "Tomcat isn't running"
        else
                echo -n "Shutting down Tomcat : "
                su - tomcat -c "cd $TOMCAT_HOME/bin ;
$TOMCAT_HOME/bin/shutdown.sh > $TOMCAT_HOME/logs/tomcat_down_stdout.log
2> $TOMCAT_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.Tomca[t] | wc -l`
        E=`expr $S` 
        if [ "$E" = "0" ] ;then 
                echo "Tomcat is stopped"
                RETVAL=-1
        else
                PIDS=`ps auxww | grep org.apache.tomcat.startup.Tomca[t]
| 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

------------- 8< -- snip 


David Cassidy wrote:
> 
> unless you want to run your tomcat as root ( Very unwise )
> makesure that you use a 'su' command in your
> call to tomcat's start script...
> 
> David
> 
> Rui Miguel Seabra wrote:
> >
> > Just hack apachectl script to launch tomcat just before apache, and to
> > shut it down right aftwards.
> >
> > On 17 Aug 2001 16:43:41 +0200, Roberto B. wrote:
> > > Ok ! but.. do you know the way to make this in automatic ( with
> > scripts at
> > > system start ) ??
> > >
> > > ----- Original Message -----
> > > From: "Barnabas Yohannes" <yohannesb@hotmail.com>
> > > To: <tomcat-user@jakarta.apache.org>
> > > Sent: Friday, August 17, 2001 3:39 PM
> > > Subject: Re: Why and How Tomcat before Apache?
> > >
> > >
> > > > I cannot answer your "why" question, because, I am not one of the
> > > developers
> > > > of apache or tomcat.  But here is the answer to your "how"
> question:
> > > >
> > > > *To stop and start your tomcat:
> > > >
> > > > cd /usr/local/tomcat
> > > >
> > > > bin/shutdown.sh
> > > >
> > > > bin/startup.sh
> > > >
> > > > *Exit from tomcat and go to your apache server:
> > > >
> > > > su
> > > >
> > > > /usr/local/apache/bin/apachectl restart
> > > >
> > > > exit
> > > >
> > > > * Another way of stopping and starting apache:
> > > >
> > > > bin/apachectl stop
> > > > bin/apachectl start
> > > >
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Roberto B." <roberto@ipermedianet.com>
> > > > To: <tomcat-user@jakarta.apache.org>
> > > > Sent: Friday, August 17, 2001 4:50 AM
> > > > Subject: Why and How Tomcat before Apache?
> > > >
> > > >
> > > > > I have a Linux/Debian system.
> > > > > I want to use Apache as web-server and Tomcat only for JSP file.
> > > > >
> > > > > Is it true that it is necessary to make start Tomcat before
> > Apache?
> > > Why?..
> > > > > and if it is true.. how??
> > > > >
> > > > > Thanks!
> > > > > Roberto.
> > > > >
> > > > >
> > >
> > --
> > + No matter how much you do, you never do enough -- unknown
> > + Whatever you do will be insignificant,
> > | but it is very important that you do it -- Ghandi
> > + So let's do it...?

Mime
View raw message