Linux Tomcat7被绑定到一个外壳上 当我的ubuntu服务器启动时,tomcat7不会运行(我无法打开localhost:8080) 当我使用ssh连接到服务器时,我可以打开localhost:8080 当我关闭ssh连接时,tomcat再次停止工作

Linux Tomcat7被绑定到一个外壳上 当我的ubuntu服务器启动时,tomcat7不会运行(我无法打开localhost:8080) 当我使用ssh连接到服务器时,我可以打开localhost:8080 当我关闭ssh连接时,tomcat再次停止工作,linux,tomcat,ubuntu,startup,Linux,Tomcat,Ubuntu,Startup,我在init.d中有一个启动脚本: export JAVA_HOME=/usr/lib/jvm/java-7-oracle export CATALINA_HOME=/home/knowroaming/apache-tomcat-7.0.34 /etc/init.d/tomcat7.sh start 我在/etc/(rc1.d到rc5.d)目录中还有指向该脚本的符号链接。 有什么想法吗?以下内容来自howtogeek.com,与Tomcat6相关,但我已经将说明用于tomcat7 自动启动

我在init.d中有一个启动脚本:

export JAVA_HOME=/usr/lib/jvm/java-7-oracle
export CATALINA_HOME=/home/knowroaming/apache-tomcat-7.0.34
/etc/init.d/tomcat7.sh start
我在/etc/(rc1.d到rc5.d)目录中还有指向该脚本的符号链接。
有什么想法吗?

以下内容来自howtogeek.com,与Tomcat6相关,但我已经将说明用于tomcat7

自动启动

要使tomcat在启动计算机时自动启动,可以添加脚本使其自动启动和关闭

sudo vi /etc/init.d/tomcat
现在粘贴以下内容:

# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-6-sun

case $1 in
start)
        sh /usr/local/tomcat/bin/startup.sh
        ;;
stop)  
        sh /usr/local/tomcat/bin/shutdown.sh
        ;;
restart)
        sh /usr/local/tomcat/bin/shutdown.sh
        sh /usr/local/tomcat/bin/startup.sh
        ;;
esac   
exit 0
您需要通过运行chmod命令使脚本可执行:

sudo chmod 755 /etc/init.d/tomcat
最后一步实际上是使用符号链接将此脚本链接到启动文件夹。执行这两个命令,我们就可以上路了

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat

Tomcat现在应该已完全安装并可运行。

唯一的问题可能是缺少启动后启动?