首页 > 代码库 > linux下配置tomcat开机自启动
linux下配置tomcat开机自启动
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开机自启动
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。