How can I start Tomcat as a daemon in Linux?
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Luca_Bianchi
Posted On:   Friday, May 11, 2001 07:31 AM

How can I start Tomcat as a daemon in Linux?
I have a SuSe 7.1 linux Version and
I have installed Tomcat 3.2.1.
Thank you

Luca

Re: How can I start Tomcat as a daemon in Linux?

Posted By:   Anonymous  
Posted On:   Saturday, May 12, 2001 09:21 AM

Hello,


I have written a small scrpit within boot.local which is placed in /etc/rc.d or /etc/init.d respectively for SuSE 7.1. I have also written a small part for halt.local to shut it down properly.


boot.local:


#! /bin/sh
#
# Copyright (c) 1996 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# Author: Florian La Roche , 1996
# Werner Fink , 1996
# Burchard Steinbild , 1996
#
# /sbin/init.d/boot.local
#
# script with local commands to be executed from init on system startup
#
. /etc/rc.config
#
# Here you should add things, that should happen directly after booting
# before we're going to the first run level.
#
JAVA_HOME=/usr/lib/java; export JAVA_HOME
# Start von Tomcat-Apache
/opt/jakarta/bin/startup.sh
#


halt.local:

#! /bin/sh
#
# Copyright (c) 1996 SuSE GmbH Nuernberg, Germany. All rights reserved.
#
# Author: Florian La Roche , 1998
# Werner Fink , 1998
# Burchard Steinbild , 1998
#
# /sbin/init.d/halt.local
#
# script with local commands to be executed from init on system shutdown
#
. /etc/rc.config
#
# Here you should add things, that should happen directly before shuting
# down.
#
JAVA_HOME=/usr/lib/java; export JAVA_HOME
# Stop von Tomcat
/opt/jakarta/bin/shutdown.sh
#

Greetings


Thomas

Re: How can I start Tomcat as a daemon in Linux?

Posted By:   AlessandroA_Garbagnati  
Posted On:   Friday, May 11, 2001 08:29 AM

Luca,

unless you need the "status" functionality (that can be added, anyway), you can use 'tomcat.sh' directly for that.

I don't know how that distribution works, but I'm pretty sure that you can link thomcat.sh in init.d



ln -s /usr/loca/tomcat/bin/tomcat.sh /etc/rc.d/init.d/tomcat



Then based on the runleve, you can create the Sxx and Kxx links in the appropriate directory. For example, if your runlevel is 3, put the file in rc3.d:



ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc3.d/S63tomcat

ln -s /etc/rc.d/init.d/tomcat /etc/rc.d/rc3.d/K37tomcat



(change S63 and K37 according to your starting sequence).


Note: Remember to manually set TOMCAT_HOME and JAVA_HOME inside tomcat.sh, because I'm not sure that the shell script, if executes from there, will be able to guess the two variables.

Re: How can I start Tomcat as a daemon in Linux?

Posted By:   Anonymous  
Posted On:   Friday, May 11, 2001 08:17 AM

Actually Tomcat already starts itself in background. If you want to start it during the boot sequence of your system, you have to write a startup script. I'm not quite sure where to place such a script in a SuSe system. The scripts are usually located in a directory called "init.d" which is placed either in /etc, /etc/rc.d, or /sbin. Use another script (e.g. apache) as template for writing one for tomcat.

About | Sitemap | Contact