---
title: "Linux下将Tomcat设置为Chkconfig启动方式 "
author: "xiaojiit"
date: "2013-12-14T16:19:43Z"
tags: []
categories: ["编程语言"]
slug: "linux-tomcat-chkconfig"
draft: false
lastmod: "2013-12-14T16:20:05Z"
id: 1989756
url: "https://sharejava.iteye.com/blog/1989756"
---

```
#!/bin/sh
#
# tomcat: Start/Stop/Restart tomcat
#
# chkconfig: 35 99 8
# description:Tomcat for web at /opt/tomcat6
#
# 
export CATALINA_BASE=/opt/tomcat6
export CATALINA_HOME=/opt/tomcat6
export CATALINA_TMPDIR=/opt/tomcat6/temp
export JAVA_OPTS='-Xms500M -Xmx2500M -server'

#Source function library.
./etc/rc.d/init.d/functions
TOMCAT=/opt/tomcat6
start(){
	echo -n "Starting Tomcat:"
	$TOMCAT/bin/catalina.sh start
}

stop(){
	echo -n "Stopping Tomcat:"
	$TOMCAT/bin/catalina.sh stop
}

case "$1" in
	start)
	  start
	  ;;
	
	stop)
	  stop
	  ;;

	restart)
	  stop
	  start
	  ;;

	*)
	  echo " Usage $0 {start|stop|restart}"
	  ;;
esac

exit $RETVAL
```

 

 

   #chkconfig --add  \*\*\*\**