码迷,mamicode.com
首页 > 系统相关 > 详细

linux下配置tomcat开机自启动

时间:2017-07-19 19:28:08      阅读:316      评论:0      收藏:0      [点我收藏+]

标签:开机自启   tin   add   echo   config   cal   export   ibm   tmp   

Linux下配置tomcat开机自启动


 
1、写一个tomcat脚本,内容如下,设置其权限为755,放在/etc/init.d/目录下
#!/bin/bash
#
# /etc/init.d/tomcat
# init script for tomcat precesses
#
# processname: tomcat
# 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="/usr/local/tomcat85"

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

 

2、在catalina.sh中(具体位置为export QIBM_MULTI_THREADED=Y之下)加入以下三行:

export JAVA_HOME=/usr/local/jdk18
export CATALINA_BASE=/usr/local/tomcat85
export CATALINA_HOME=/usr/local/tomcat85
export CATALINA_TMPDIR=/usr/local/tomcat85/temp

 

3、将启动脚本加入到chkconfig的管理之下

chkconfig --add tomcat

 

4、可以用services tomcat start|stop来管理tomcat

 

 


 

linux下配置tomcat开机自启动

标签:开机自启   tin   add   echo   config   cal   export   ibm   tmp   

原文地址:http://www.cnblogs.com/zhangzl419/p/7207355.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!