CentOS) Install Tomcat (install as service with Shell script)

Source: Internet
Author: User
Tags glassfish

#! /bin/sh

#shell script takes care of starting and stopping

# The GlassFish DAS and GlassFish instance.

#

# Chkconfig:-64 36

# Description:tomcat Auto Start

#/ETC/INIT.D/TOMCATD

# Tomcat Auto-start

# Source function library.

#. /etc/init.d/functions

# source Networking configuration.

#. /etc/sysconfig/network

Retval=0

Export jre_home=/usr/local/jdk1.7.0

Export Catalina_home=/home/tomcat

Export Catalina_base=/home/tomcat

Start ()

{

If [-f $CATALINA _home/bin/startup.sh];

Then

echo $ "Starting Tomcat"

$CATALINA _home/bin/startup.sh

Retval=$?

echo "OK"

Return $RETVAL

Fi

}

Stop ()

{

If [-f $CATALINA _home/bin/shutdown.sh];

Then

echo $ "Stopping Tomcat"

$CATALINA _home/bin/shutdown.sh

Retval=$?

Sleep 1

PS-FWWU Yhjhoo (System user name) | grep apache-tomcat|grep-v grep | Grep-v PID | awk ' {print $} ' |xargs kill-9

echo "OK"

# [$RETVAL-eq 0] && rm-f/var/lock/...

Return $RETVAL

Fi

}


Case "$" in

Start

Start

;;

Stop

Stop

;;

Restart

echo $ "restaring Tomcat"

$ stop

Sleep 1

$ start

;;

*)

echo $ "Usage: $ {Start|stop|restart}"

Exit 1

;;

Esac

Exit $RETVAL


This article is from the "System website Operations" blog, please be sure to keep this source http://cgc888.blog.51cto.com/3989433/1709935

CentOS) Install Tomcat (install as service with Shell script)

Related Article

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.