首页 > 系统服务 > 详细

linux设置tomcat开机启动

时间:2016-02-17 17:18:19      阅读:257      评论:0      收藏:0      [点我收藏+]
[root@iZ94j7ahvuvZ ~]# cd /etc/rc.d/
[root@iZ94j7ahvuvZ rc.d]# cat rc.local 
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you dont
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
#./doc/redis-3.0.4/src/redis-server /doc/redis-3.0.4/redis.conf 
export JAVA_HOME=/usr/local/java/jdk1.7.0
/usr/local/tomcat/apache-tomcat-7.0.62/bin/startup.sh start
[root@iZ94j7ahvuvZ rc.d]# 
解析rc.local文件

1.配置环境变量
export JAVA_HOME
=/usr/local/java/jdk1.7.0 (JDK的安装目录,可以用$echo $JAVA_HOME获取) 以下是我的服务器寻找JAVA_HOME环境变量的方法 [root@iZ94j7ahvuvZ rc.d]# $echo $JAVA_HOME -bash: /usr/local/java/jdk1.7.0: is a directory
2.配置tomcat路径
/usr/local/tomcat/apache-tomcat-7.0.62/bin/startup.sh start
这句话是tomcat的web服务器的startup.sh位置路径 再加上start即可

3.保存文件
按esc然后输入:wq 此刻我们已经保存好rc.local输入的内容了

4.修改rc.local文件为可执行,如:chmod +x rc.local

5.让服务器重启
shutdown -r now

6.开机登录后执行
ps -ef|grep java
看重启后登录是否有java进程 如果有则ok

[root@iZ94j7ahvuvZ rc.d]# ps -ef|grep java

root 1102 1 0 16:19 ? 00:00:04 /usr/local/java/jdk1.7.0/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/apache-tomcat-7.0.62/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/apache-tomcat-7.0.62/endorsed -classpath /usr/local/tomcat/apache-tomcat-7.0.62/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-7.0.62/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat/apache-tomcat-7.0.62 -Dcatalina.home=/usr/local/tomcat/apache-tomcat-7.0.62 -Djava.io.tmpdir=/usr/local/tomcat/apache-tomcat-7.0.62/temp org.apache.catalina.startup.Bootstrap start start
root 1187 1005 0 16:28 pts/1 00:00:00 grep java




 

linux设置tomcat开机启动

原文:http://www.cnblogs.com/sz-jack/p/5195779.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!