首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Tomcat在重新启动时启动: init.d脚本不成功

Tomcat在重新启动时启动: init.d脚本不成功
EN

Stack Overflow用户
提问于 2019-06-27 02:21:50
回答 1查看 1.5K关注 0票数 1

我需要在重启linux操作系统后启动tomcat。我无法让init.d在重启时正常工作。

操作系统和版本:

JRE: 1.8.0
JAVA: 1.8.0
Tomcat:  8.5.34
Linux:  Amazon Linux 2

*以ROOT身份完成所有步骤

TOMCAT部署配置:

1)  Install tomcat 8.5.34 using a tar.gz gzip file
2)  configure /{$TOMCAT}/conf/server.xml to use 443 connectors
3)  Deploy MicroStrategy application through deploying a .war file on restart
4)  configure SSL keys using Java Key Store
5)  configure microstrategy webapp for SAML authentication using PING

init.d脚本部署配置

注意:我已经通过/etc/init.d/tomcat和chkconfig实用程序尝试了各种脚本。

 1)  Create tomcat using vi     2)  Insert script (I have tried numerous scripts, but this one seems to      be the clostest to exactly what I need and the most explicit)     3)  chmod 755 /etc/init.d/tomcat     4)  chkconfig --add tomcat     5)  chkconfig --level 2345 tomcat on  (This command is not successful)     6)  chkconfig --list tomcat (returns tomcat 0:off   1:off   2:off   3:on    4:on    5:on    6:off)

测试此脚本成功:

./etc/init.d/tomcat start
./etc/init.d/tomcat stop
./etc/init.d/tomcat restart 

已确认chkconfig创建了以下链接:

/etc/rc1.d  K20tomcat
/etc/rc2.d  K20tomcat
/etc/rc3.d  S82tomcat
/etc/rc4.d  S82tomcat
/etc/rc5.d  S82tomcat
/etc/rc6.d  K20tomcat

Tomcat的脚本文件

#!/bin/sh
#
# chkconfig: 345 82 20
#
# description:  Tomcat Service


JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
JRE_HOME=/usr/lib/jvm/jre-1.8.0-openjdk
CATALINA_HOME=/opt/apache-tomcat-8.5.34
export JAVA_HOME JRE_HOME CATALINA_HOME
case $1 in
start)
cd $CATALINA_HOME/bin
./startup.sh
;;
stop)
cd $CATALINA_HOME/bin
./shutdown.sh
;;
restart)
cd $CATALINA_HOME/bin
./shutdown.sh    
./startup.sh
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0

期望

我希望在重新启动后,可以从指向此设备的公共URL访问位于{$TOMCAT}/webapps/ROOT的基本网址。tomcat服务在重新启动后仍处于已停止状态。

有什么建议吗?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56778930

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档