linux tomcat 自启动

重启后 tomcat 还存在 

 

linux  tomcat 自启动

 

36.安装tomcat
vim /etc/rc.d/init.d/tomcat

	#!/bin/bash
	#
	# baoyou  [email protected] 15010666051
	# /etc/rc.d/init.d/tomcat
	# init script for tomcat precesses
	#
	# processname: tomcat
	# description: tomcat is a j2se server
	# chkconfig: 2345 86 16
	# description: Start up the Tomcat servlet engine.

	if [ -f /etc/init.d/functions ]; then
	. /etc/init.d/functions
	elif [ -f /etc/rc.d/init.d/functions ]; then
	. /etc/rc.d/init.d/functions
	else
	echo -e "/atomcat: unable to locate functions lib. Cannot continue."
	exit -1
	fi

	RETVAL=$?
	CATALINA_HOME="/home/baoyou/soft/apache-tomcat-7.0.75"

	case "$1" in
	start)
	if [ -f $CATALINA_HOME/bin/startup.sh ];
	then
	echo $"Starting Tomcat"
	$CATALINA_HOME/bin/startup.sh
	fi
	;;
	stop)
	if [ -f $CATALINA_HOME/bin/shutdown.sh ];
	then
	echo $"Stopping Tomcat"
	$CATALINA_HOME/bin/shutdown.sh
	fi
	;;
	*)
	echo $"Usage: $0 {start|stop}"
	exit 1
	;;
	esac

	exit $RETVAL

chmod 755 /etc/rc.d/init.d/tomcat
chkconfig --add tomcat

vim /home/baoyou/soft/apache-tomcat-7.0.75/bin/catalina.sh 
export JAVA_HOME=/home/baoyou/soft/jdk1.7.0_79
export JRE_HOME=/home/baoyou/soft/jdk1.7.0_79/jre
export CATALINA_HOME=/home/baoyou/soft/apache-tomcat-7.0.75
export CATALINA_BASE=/home/baoyou/soft/apache-tomcat-7.0.75
export CATALINA_TMPDIR=/home/baoyou/soft/apache-tomcat-7.0.75/temp
/home/baoyou/soft/apache-tomcat-7.0.75/bin/catalina.sh start
service tomcat start
service tomcat stop
添加防火墙对外
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
firewall-cmd --list-all

 

 

 

 

 

 

 

 

 

 

 

 

 

捐助开发者 

在兴趣的驱动下,写一个免费的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(支持支付宝和微信 以及扣扣群),没钱捧个人场,谢谢各位。

 

个人主页http://knight-black-bob.iteye.com/



 
 
 谢谢您的赞助,我会做的更好!

猜你喜欢

转载自knight-black-bob.iteye.com/blog/2392724