Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can not start tomcat from /etc/rc.d

40 views
Skip to first unread message

narke

unread,
Sep 19, 2010, 11:23:16 PM9/19/10
to
I put a rc.tomcat script under /etc/rc.d and make it executable. The
script can launch tomcat server: /opt/apache-tomcat/bin/startup.sh

But when my slack box reboots, the tomcat server cannot get launched.
But I can login to the server and manually do the job:
/etc/rc.d/rc.tomcat start

What prevent tomcat from starting in boot time? Thanks.

--
Life is the only flaw in an otherwise perfect nonexistence
-- Schopenhauer

narke


Dan C

unread,
Sep 19, 2010, 11:36:03 PM9/19/10
to
On Mon, 20 Sep 2010 03:23:16 +0000, narke wrote:

> I put a rc.tomcat script under /etc/rc.d and make it executable. The
> script can launch tomcat server: /opt/apache-tomcat/bin/startup.sh
>
> But when my slack box reboots, the tomcat server cannot get launched.
> But I can login to the server and manually do the job:
> /etc/rc.d/rc.tomcat start
>
> What prevent tomcat from starting in boot time? Thanks.

Because nothing in the startup scripts knows there is a rc.tomcat script
there... You need to tell it to start, by calling it from rc.local.

Add this to /etc/rc.d/rc.local :

### Start Tomcat server
if [ -x /etc/rc.d/rc.tomcat ]; then
/etc/rc.d/rc.tomcat start
fi


--
"Ubuntu" -- an African word, meaning "Slackware is too hard for me".
"Bother!" said Pooh, as he puked on Christopher Robin.
Usenet Improvement Project: http://twovoyagers.com/improve-usenet.org/
Thanks, Obama: http://brandybuck.site40.net/pics/politica/thanks.jpg

Keith Keller

unread,
Sep 19, 2010, 11:38:28 PM9/19/10
to
On 2010-09-20, narke <narke...@gmail.com> wrote:
> I put a rc.tomcat script under /etc/rc.d and make it executable. The
> script can launch tomcat server: /opt/apache-tomcat/bin/startup.sh
>
> But when my slack box reboots, the tomcat server cannot get launched.
> But I can login to the server and manually do the job:
> /etc/rc.d/rc.tomcat start

It sounds like an environment issue. Did you check Tomcat's error logs?
It probably has a hint on why it couldn't start up.

--keith


--
kkeller...@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

Helmut Hullen

unread,
Sep 20, 2010, 1:51:00 AM9/20/10
to
Hallo, narke,

Du meintest am 20.09.10:

> I put a rc.tomcat script under /etc/rc.d and make it executable. The
> script can launch tomcat server: /opt/apache-tomcat/bin/startup.sh

> But when my slack box reboots, the tomcat server cannot get launched.
> But I can login to the server and manually do the job:
> /etc/rc.d/rc.tomcat start

> What prevent tomcat from starting in boot time? Thanks.

Nearly every "rc.xyz" script in "/etc/rc.d" has to be called by another
"rc.zyx" script. Take a look at "rc.M"; and there you can see the call
for "rc.local".

If you add a line

test -x /etc/rc.d/rc.tomcat && /etc/rc.d/rc.tomcat

in "/etc/rc.d/rc.local" then the machine should do what you want.

Viele Gruesse
Helmut

"Ubuntu" - an African word, meaning "Slackware is too hard for me".

+Alan Hicks+

unread,
Sep 20, 2010, 9:29:36 AM9/20/10
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2010-09-20, Helmut Hullen <Hel...@Hullen.de> wrote:
> If you add a line
>
> test -x /etc/rc.d/rc.tomcat && /etc/rc.d/rc.tomcat
>
> in "/etc/rc.d/rc.local" then the machine should do what you want.

That's a tad bit unreadable to a novice user such as the OP. The
syntax used by Slackware is much clearer.

rc.local
========

if [ -x /etc/rc.d/rc.tomcat ]; then
/etc/rc.d/rc.tomcat start
fi

To the OP: if you want or need to gracefully shut down tomcat when the
system goes through shutdown, add the following lines to
rc.local_shutdown (creating it and making it executable if necessary).

rc.local_shutdown
=================
if [ -x /etc/rc.d/rc.tomcat ]; then
/etc/rc.d/rc.tomcat stop
fi

- --
It is better to hear the rebuke of the wise,
Than for a man to hear the song of fools.
Ecclesiastes 7:5
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkyXYcAACgkQDyaEVbMHxsaf7ACfVC6Www70fiwTmxBYhdOiY7Gq
exMAoKZuh+KQRhH8zY7iYqNTSoOPjo3l
=xFU5
-----END PGP SIGNATURE-----

Dan C

unread,
Sep 20, 2010, 9:40:11 AM9/20/10
to
On Mon, 20 Sep 2010 13:29:36 +0000, +Alan Hicks+ wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2010-09-20, Helmut Hullen <Hel...@Hullen.de> wrote:
>> If you add a line
>>
>> test -x /etc/rc.d/rc.tomcat && /etc/rc.d/rc.tomcat
>>
>> in "/etc/rc.d/rc.local" then the machine should do what you want.
>
> That's a tad bit unreadable to a novice user such as the OP. The syntax
> used by Slackware is much clearer.
>
> rc.local
> ========
>
> if [ -x /etc/rc.d/rc.tomcat ]; then
> /etc/rc.d/rc.tomcat start
> fi

Which is exactly what I posted about 10 hours ago....


--
"Ubuntu" -- an African word, meaning "Slackware is too hard for me".

"Bother!" said Pooh, as he slipped his date a Purple Microdot.

Lew Pitcher

unread,
Sep 20, 2010, 11:50:08 AM9/20/10
to
On September 19, 2010 23:23, in alt.os.linux.slackware, narke...@gmail.com
wrote:

> I put a rc.tomcat script under /etc/rc.d and make it executable. The
> script can launch tomcat server: /opt/apache-tomcat/bin/startup.sh
>
> But when my slack box reboots, the tomcat server cannot get launched.
> But I can login to the server and manually do the job:
> /etc/rc.d/rc.tomcat start
>
> What prevent tomcat from starting in boot time? Thanks.

Scripts in /etc/rc.d are not executed 'automagically'; they need some other
component to specifically and actively run them.

You have (at least) three choices:
1) Link your rc.tomcat to the appropriate /etc/rc.d/rc[0-6].d directory (or
directories, where the variable number [0-6] represents the runstate you
want your script to run in). This is the "SysVinit" way of running startup
scripts, and will be compatable with other (non-Slackware) distributions.

2) Leave your rc.tomcat in /etc/rc.d, and modify one of the other rc scripts
in /etc/rc.d to start it. Others have suggested this already, pointing out
options as to /which/ script you can modify to start (and stop)
your /etc/rc.d/rc.tomcat script,

3) Leave your rc.tomcat in /etc/rc.d, and modify your /etc/inittab to invoke
it at the proper point in your startup (and shutdown). This has the benefit
of permitting you to *properly* place your tomcat startup and shutdown
within order of things done, while not modifying any of the Slackware rc
scripts. The drawback is that single inittab entries have coarser control
over events than the scripts they invoke.

HTH
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576
Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
---------- Slackware - Because I know what I'm doing. ------


narke

unread,
Sep 20, 2010, 3:27:03 PM9/20/10
to
On 2010-09-20, Dan C <youmust...@lan.invalid> wrote:
> On Mon, 20 Sep 2010 03:23:16 +0000, narke wrote:
>
>> I put a rc.tomcat script under /etc/rc.d and make it executable. The
>> script can launch tomcat server: /opt/apache-tomcat/bin/startup.sh
>>
>> But when my slack box reboots, the tomcat server cannot get launched.
>> But I can login to the server and manually do the job:
>> /etc/rc.d/rc.tomcat start
>>
>> What prevent tomcat from starting in boot time? Thanks.
>
> Because nothing in the startup scripts knows there is a rc.tomcat script
> there... You need to tell it to start, by calling it from rc.local.
>
> Add this to /etc/rc.d/rc.local :
>
> ### Start Tomcat server
> if [ -x /etc/rc.d/rc.tomcat ]; then
> /etc/rc.d/rc.tomcat start
> fi
>
>

Sorry, I forget to say that I've already put this in rc.M :) So this is
not the cause of the problem.

narke

unread,
Sep 20, 2010, 3:30:44 PM9/20/10
to
On 2010-09-20, Keith Keller <kkeller...@wombat.san-francisco.ca.us> wrote:
> On 2010-09-20, narke <narke...@gmail.com> wrote:
>> I put a rc.tomcat script under /etc/rc.d and make it executable. The
>> script can launch tomcat server: /opt/apache-tomcat/bin/startup.sh
>>
>> But when my slack box reboots, the tomcat server cannot get launched.
>> But I can login to the server and manually do the job:
>> /etc/rc.d/rc.tomcat start
>
> It sounds like an environment issue. Did you check Tomcat's error logs?
> It probably has a hint on why it couldn't start up.
>
> --keith
>

Thanks for the suggestion. Now it may be too later to check the log,
there have been already too many logs files in $CATALINA_HOME/logs.
Could you please tell me what log file the errors usually go?

narke

unread,
Sep 20, 2010, 3:31:38 PM9/20/10
to
On 2010-09-20, +Alan Hicks+ <al...@lizella.netWORK> wrote:
>
> On 2010-09-20, Helmut Hullen <Hel...@Hullen.de> wrote:
>> If you add a line
>>
>> test -x /etc/rc.d/rc.tomcat && /etc/rc.d/rc.tomcat
>>
>> in "/etc/rc.d/rc.local" then the machine should do what you want.
>
> That's a tad bit unreadable to a novice user such as the OP. The
> syntax used by Slackware is much clearer.
>
> rc.local
>========
>
> if [ -x /etc/rc.d/rc.tomcat ]; then
> /etc/rc.d/rc.tomcat start
> fi
>
> To the OP: if you want or need to gracefully shut down tomcat when the
> system goes through shutdown, add the following lines to
> rc.local_shutdown (creating it and making it executable if necessary).
>
> rc.local_shutdown
>=================
> if [ -x /etc/rc.d/rc.tomcat ]; then
> /etc/rc.d/rc.tomcat stop
> fi
>
> - --
> It is better to hear the rebuke of the wise,
> Than for a man to hear the song of fools.
> Ecclesiastes 7:5

Thanks for the suggestion of rc.local_shutdown, I like to do it now :)

Helmut Hullen

unread,
Sep 20, 2010, 3:35:00 PM9/20/10
to
Hallo, narke,

Du meintest am 20.09.10:

>> Add this to /etc/rc.d/rc.local :


>>
>> ### Start Tomcat server
>> if [ -x /etc/rc.d/rc.tomcat ]; then
>> /etc/rc.d/rc.tomcat start
>> fi
>>
>>

> Sorry, I forget to say that I've already put this in rc.M :) So this
> is not the cause of the problem.

Then expand the lines:

if [ -x /etc/rc.d/rc.tomcat ]; then
set -x
export SHELLOPTS
/etc/rc.d/rc.tomcat start
set +x
read -p "press any key " dummy
fi

Viele Gruesse
Helmut

"Ubuntu" - an African word, meaning "Slackware is too hard for me".

Ed Wilson

unread,
Sep 21, 2010, 10:30:27 AM9/21/10
to
narke wrote:


> Sorry, I forget to say that I've already put this in rc.M :) So this is
> not the cause of the problem.
>

Where in rc.M did you put it? Somewhere in the middle of rc.M your network
hardware is initialized and configured, I think you would want to be after
the networking stuff.

--
Ed

Eef Hartman

unread,
Sep 21, 2010, 10:45:46 AM9/21/10
to
narke <narke...@gmail.com> wrote:
> Sorry, I forget to say that I've already put this in rc.M :) So this is
> not the cause of the problem.

It is _not_ a good idea to modify rc.M itself. Put the startup for
tomcat in "rc.local", that one will NOT get overwritten by the next
security update to the rc startup scripts.
--
******************************************************************
** Eef Hartman, Delft University of Technology, dept. SSC/ICT **
** e-mail: E.J.M....@tudelft.nl - phone: +31-15-27 82525 **
******************************************************************

Eef Hartman

unread,
Sep 21, 2010, 10:51:00 AM9/21/10
to
Ed Wilson <ewi...@jackmaxton.com> wrote:
> Where in rc.M did you put it? Somewhere in the middle of rc.M your network
> hardware is initialized and configured, I think you would want to be after
> the networking stuff.

And that is the other reason you don't want to modify rc.M, it basically
starts everything, so placement within that script is rather critical.
rc.local, being executed after everything else has been started, so
i.e. also the name server (when needed) and/or apache itself, is
the normal place for user additions.

Morten L

unread,
Sep 22, 2010, 9:20:13 AM9/22/10
to
narke <narke...@gmail.com> skrev 2010-09-20:
> I put a rc.tomcat script under /etc/rc.d and make it executable. The
> script can launch tomcat server: /opt/apache-tomcat/bin/startup.sh
>
> But when my slack box reboots, the tomcat server cannot get launched.
> But I can login to the server and manually do the job:
> /etc/rc.d/rc.tomcat start
>
> What prevent tomcat from starting in boot time? Thanks.
>

When started from rc.local the environment variable
JAVA_HOME is not set, so you just need to start it this way:
export JAVA_HOME=/usr/lib/java
/opt/apache-tomcat/bin/startup.sh

enjoy


--
Morten L

0 new messages