tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Turner, John" <JTur...@AAS.com>
Subject RE: Start tomcat before apache on RedHat7.3
Date Mon, 13 Jan 2003 13:50:28 GMT

Nope, where startup (and shutdown) scripts are located has no bearing
whatsoever on when they are started.  Where != when.

The init directories are known as rcN.d, where N = a number.  That number
defines runlevel, not startup order.  A UNIX/Linux machine has different
runlevels.  Single user, multi-user, single-user with network, maintenance,
multi-user with X windows, whatever.  Each one of those runlevels has a
number.  Which run level the computer is booting to defines which init
directory is used to startup services.  The default runlevel is typically 3
(multi-user with network) or 5 (multi-user with network with X-Windows), in
the case of Red Hat.  Other variants are similar.

Now, within a particular rcN.d directory, you will typically see files that
have names like "S55sshd" and "S85tomcat" or "SNNservice" or whatever.  Some
will be named "KNNservice".  NN in this case is also a number, and THAT
number defines startup order.  That is, S55service will startup before
S85service.  "S" means "start at boot" and "K" means "do not start at boot".
So, if you have a S file that you want to stop from running at boot, you can
"cp -p SNNservice KNNservice" and that will stop it the next time you boot.
Utilities like Red Hat's chkconfig, etc. can manage this for you, or you can
get in and hack it around manually, whichever makes you comfortable.

The point here is NOT startup order, but startup TIME.  That is, elapsed
time, not sequence time.  Tomcat needs time to startup, but your init
scripts don't know that, so they will be good little scripts and try to
execute as fast as possible, in the milliseconds, meaning that Apache's
startup script or command will execute right after Tomcat's, while Tomcat is
still trying to complete, especially in the case of using ApacheConfig for
mod_jk.  

You want to slow all of that down.  The solution is to 1) delay the point
when Tomcat's startup script reports to init that things are OK and init can
continue with the next service in the list, which will eventually be Apache,
2) delay the point when Apache's startup command/script is executed, 3)
start Tomcat at boot and Apache manually, or 4) start both manually, Tomcat
first, and Apache second after a self-imposed delay that gives Tomcat a
chance to complete.

Word of advice:  STAY OUT of /etc/rc.d/init.d unless you know exactly what
you are doing, or have a good backup and a rescue disk...messing around in
there can cause trouble, like an infinite loop when trying to boot or
whatever.  You want to do things in the appropriate runlevel directory, like
rc3.d or whatever, and use a tool like chkconfig to manage your runlevel
dirs and their links to the actual start/stop scripts.

John


> -----Original Message-----
> From: Arcadius A. [mailto:ahouans@sh.cvut.cz]
> Sent: Monday, January 13, 2003 8:35 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: Start tomcat before apache on RedHat7.3
> 
> 
> 
> "Turner, John" <JTurner@AAS.com> wrote in message
> news:83F0258A9996D311B14200A0C98F173602F22BDF@aas-internet.aas.com...
> >
> > I'm assuming that you are using the ApacheConfig class to 
> auto-generate
> > configuration directives for Apache's httpd.conf.
> >
> > Tomcat needs time to start up, and the ApacheConfig class 
> needs time to
> > write mod_jk.conf (or whatever file you are using).
> >
> > So, you have to put a delay into the process somewhere.  
> Like a "sleep 20"
> > or something right after the Tomcat script executes, but 
> before Apache is
> > started, or take both of them out of init.d and put the startup into
> > rc.local where you have more explicit control over what 
> runs when, and
> stick
> > the delay in there.
> >
> > John
> >
> 
> Hello!
> Thanks for the reply....
> I've notice that under the directory  "/etc/rc.d/" are several
> subdirectories "init.d", "rc0.d" , "rc1.d", ... ,"rc6.d".
> Wouldn't it be easier to just put tomcat startup script in "rci.d" and
> apache startup script in "rcj.d" where i<j ?
> 
>  (IMHO, the order in which startup scripts are started 
> depends on where
> they are located)
> 
> Thanks.
> 

--
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