tomcat startup script not working at boot
Nils Kassube
kassube at gmx.net
Sat Feb 26 10:59:51 UTC 2011
Tapas Mishra wrote:
> On Sat, Feb 26, 2011 at 11:37 AM, Nils Kassube <kassube at gmx.net>
wrote:
> > Tapas Mishra wrote:
> >> 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.
> >
> > I think you are on the wrong thrack. If you execute your
> > /etc/bash.bashrc script, the environment variables set by that
> > script will not be used by other startup scripts because those
> > other scripts are new independent jobs. If you want specific
> > environment variables set in a specific script, you should set
> > them in that very script.
> >
> > Then you refer to /etc/rc5.d/S20tapas-tomcat. Are you sure it will
> > ever be used? The default runlevel for Ubuntu is 2, not 5. It
> > would only work if you have a special setup which uses runlevel 5.
> >
> > I think you want to read
> > "/usr/share/doc/sysv-rc/README.runlevels.gz".
>
> I read the doc you mentioned
> and excerpts from above doc
>
> "3. Switching runlevels.
>
> When one switches from (for example) runlevel 2 to runlevel 3,
> /etc/init.d/rc will first execute in alphabetical order a"
>
> So I read /etc/init.d/rc
>
> and I see only following being set there
>
> PATH=/sbin:/usr/sbin:/bin:/usr/bin
> export PATH
>
> I thin up to here I understood correctly.
Yes, I think so. But you didn't mention how you switch to runlevel 5. Is
it done from one of your init scripts or is it done manually?
> But here in this script
> /etc/init.d/rc which is invovked when system moves from run level 2
> (Default in Ubuntu as you said)
> to run level 5 I do not see any where /etc/bash.basrc into picture
> and the only thing set if I understood here correctly is
> PATH and no other variable.
/etc/bash.bashrc has nothing to do with init scripts. The first line of
that file is this:
# System-wide .bashrc file for interactive bash(1) shells.
It is _only_ used for interactive shells but those init scripts are not
interactive login sessions. An interactive shell is what you get when
you enter your login and password at a terminal.
> So how does it happen that when I a user logs in to run level 5 he is
What do you mean with "when I a user logs in to run level 5"? Again, you
didn't mention how you switch to runlevel 5. Unless you do that manually
or by one of your init scripts, that never happens automatically on a
Debian or Debian derived system like Ubuntu.
> able to get the environment variables in
> /etc/bash.bashrc (if you leave my question for some time of my tomcat
> script which is working)
> I want to know in general how it happens that the variables defined
> in $HOME/.basrch
> or /etc/bash.bashrc gets initialized
> 1) at which run level and
> 2) what script (if some one can point) invokes them.
1) It has nothing to do with runlevels (see above).
2) It is included by /etc/profile but only for interactive shells.
Anyway, talking about bashrc is only misleading when you want to run
daemons which are invoked by init scripts because there is no
interactive shell involved. And as I understand this thread, that is
what you want to do. If you really want to include /etc/bash.bashrc in
your init script you can do it with a line
. /etc/bash.bashrc
somewhere in your script before you need the variables set by
/etc/bash.bashrc. However I'd rather copy the needed lines from that
file to your init script.
Nils
More information about the ubuntu-users
mailing list