Configure multiple tomcat services in linux

Source: Internet
Author: User

Multiple tomcat servers run on a linux server. Because the tomcat process names are "java", you cannot add them all as services, creates multiple soft links for java.
The procedure is as follows:
1. Establish a soft connection to java
Ln-sf/opt/jre1.6.0 _ 30/bin/java/usr/bin/tomcat-bid
After tomcat is started, check that the process name is tomcat-bid. Use a different name for each tomcat.
2. Modify the setclasspath. sh file in the tomcat/bin directory.
Find the _ RUNJAVA = "$ JRE_HOME"/bin/java line, usually at the end.
To:
_ RUNJAVA = "$ JRE_HOME"/bin/tomcat-bid
Tomcat-bid is the process name, and each tomcat is changed to a different name.
3. Create the tomcat-bid file in the/etc/init. d/directory. Note that the permission should be set to executable. The content is as follows:
#! /Bin/bash
#
# Startup script for the tomcat
#
# Chkconfig: 345 80 15
# Description: Tomcat with bid
# Source function library.
./Etc/rc. d/init. d/functions
Start (){
If [-z $ (/sbin/pidof tomcat-bid)]; then
Echo "Starting tomcat-bid"
/Opt/tomcat-bid/bin/startup. sh
Touch/var/lock/subsys/tomcat-bid
Else
Echo "tomcat already running"
Fi
}
Stop (){
If [! -Z $ (/sbin/pidof tomcat-bid)]; then
Echo "Shutting down tomcat"
/Opt/tomcat-bid/bin/shutdown. sh
Until [-z $ (/sbin/pidof java)]; do:; done
Rm-f/var/lock/subsys/tomcat-bid
Else
Echo "tomcat not running"
Fi
}
Case "$1" in
Start)
Start
;;
Stop)
Stop
;;
Restart)
Stop
Start
;;
Status)
/Opt/tomcat-bid/bin/catalina. sh version
;;
*)
Echo "Usage: $0 {start | stop | restart | status }"
Esac
Exit 0
 
4. Add the service to linux
Chkconfig -- add tomcat-bid
Chkconfig tomcat-bid on
View tomcat service status
Chkconfig -- list tomcat-bid
 
5. Use service commands to control tomcat
Service tomcat-bid status
 

Author surelei

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.