场景

        配置Tomcat作为服务启动

创建软连接ln -s /opt/web/apache-tomcat-8.5.41/bin/catalina.sh  /etc/init.d/tomcat

添加开机启动  chkconfig --add  tomcat

手动启动测试如下:

[root@localhost bin]# service tomcat start
Cannot find /etc/bin/setclasspath.sh
This file is needed to run this program


解决

        setclasspath.sh脚本跟catalina.sh脚本是在同一个目录,说明没有找到对应的启动目录,修改catalina.sh文件,指定tomcat的安装目录

#!/bin/sh
#chkconfig: 2345 80 90
#description: tomcat auto start
#processname: tomcat
#JAVA_HOME=/usr/lib/jvm/jre-1.8.0
CATALINA_HOME=/opt/web/apache-tomcat-8.5.41/ 

添加最后一行即可