tomcat startup script not working at boot

MR ZenWiz mrzenwiz at gmail.com
Sat Feb 26 20:57:22 UTC 2011


On Fri, Feb 25, 2011 at 8:53 PM, Tapas Mishra <mightydreams at gmail.com> wrote:
> On Sat, Feb 26, 2011 at 12:28 AM, MR ZenWiz <mrzenwiz at gmail.com> wrote:
>>
>> Did you export JAVA_HOME?
> Yes I was able to use things without init script.
>>
>> What .bashrc is this in?  If it is tied to a specific user account,
> Not specific  it was in roots bashrc

Hello.  root's .bashrc is in /root, which belongs to root's login
account.  IOW, it *is* tied toa specific user - root.

>> that might not work - you may need to edit one of the global bashrc
>> files (/etc/bash.bashrc or /etc/bashrc, depending on which one you
>> have).
> How do you decide when system is booting then whether
> /etc/rc5.d/S20tapas-tomcat will execute first or
> /etc/bash.bashrc will come first in boot sequence so that JAVA_HOME or
> any other variable comes first.

As someone else wisely pointed out (and I did not), /etc/bash.bashrc
is (normally) executed for login shells, so if you want it executed in
another shell script, like a startup script, you have to source it
directly.  Given that this sounds like what you want to do, it might
be wise to do so.

Also, if you put your settings into root's .bashrc (i.e.,
/root/.bashrc), it would not be difficult to source that file from a
startup script, although doing so is non-standard....

You should read the man pages on the shells carefully do determine
which global files get executed when and use them accordingly.
/etc/bash.bashrc is typically executed under some more global shell
profile (most often /etc/profile) that is run for all login shells but
then *usually* contains some discriminator to tell it which profile or
rc script to run next.  This also differs between distros (RH != SLES
!= Ubuntu, although they are all similar).  It too me a fair number of
iterations to create a .bashrc that would do the same thing for all
three distros so I can use the same base file on those three brands of
Linux plus MAC and Solaris.

One example: In Ubuntu, a login bash shell runs /etc/profile, then the
first of ~/.bash_profile, ~/.bash_login or ~/.profile whereas an
interactive shell starts up with /etc/bash.bashrc and then ~/.bashrc,
in that order.  My ~/.bash_profile just sources my ~/.bashrc, which
makes it *almost* exactly the same for logins and interactive shells,
the way I like it.  Then there are other little details to make them
behave the same way, plus cross-system compatibility issues as
well....




More information about the ubuntu-users mailing list