我需要在重启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服务在重新启动后仍处于已停止状态。
有什么建议吗?
https://stackoverflow.com/questions/56778930
复制相似问题