#! /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)