Linux下建立Web应用环境(二)

遇到问题1tomcat: unrecognized service

配置tomcat自启动服务
编写tomcat服务文件(见附件)

放在/etc/initd/

执行 chmod +x /etc/init.d/tomcat设置权限,否则会出现tomcat: unrecognized service的错误提示


 

问题2service tomcat does not support chkconfig

 [root@OWLinux ~]# chkconfig --add tomcat

service tomcat does not support chkconfig

解决方法1

完成后是无法用chkconfig --add tomcat设置为自动启动,会显示错误信息:service tomcat does not support chkconfig ,需要修改脚本$CATALINA_HOME/bin/jsvc-src/native/Tomcat.sh,并cp/etc/rc.d/init.d

 

解决方法2:参照http://www.cactus.org.cn/2008/04/linuxtomcat.html

在脚本的最前面加上

#!/bin/bash 

# chkconfig: 2345 10 90 

# description: Starts and Stops the Tomcat daemon.  

再运行命令

sudo /sbin/chkconfig –add tomcat

sudo /sbin/chkconfig –list

看到tomcat,一切搞定。

 

自己更改(执行通过)

#!/bin/sh

# chkconfig: 345 88 14

# description: Starts and Stops the Tomcat daemon.

 

问题3-bash: ckhconfig: command not found

[root@OWLinux ~]#  ckhconfig --list

-bash: ckhconfig: command not found

解决:

[root@OWLinux init.d]# which chkconfig

/sbin/chkconfig

[root@OWLinux init.d]# /sbin/chkconfig  --list

这样可以看到信息。但没有彻底解决,最终解决:在rootPATH中加了sbin就行。

 

[root@OWLinux init.d]#  /sbin/chkconfig  --list  tomcat

tomcat          0:off   1:off   2:off   3:on    4:on    5:on    6:off

 

 

问题4

chkconfig: 2345 10 90    chkconfig: 345 88 14   怎么理解?

其中我们要修改的就是:# chkconfig: 345 99 01 后面的数字部分
345 99 01
这三组数字到底是什么意思呢?
345
代表的是[color="#ff0000"]系统的启动级别。也就是说系统在345的启动级别的时候会启动nagios服务
99 01
代表的是系统启动的时候 [color="#ff0000"]应用程序也就是[color="#ff0000"]服务的启动级别

实践证实,数值越小,就越先启动和关闭。
理解了这个,那在处理问题的时候就相当简单了,要不然都不知道怎么去修改那个服务的启动顺序。呵呵 

 

2345表示在runlevel 2 3 4 5下被启动操作系统, 20 80 是优先级
20
为启动操作系统, 80为关闭. 即在rcIII.d您可能看到 S20 或者是 K80.

优先即是一个两位数

 

 

Linux下两种自动启动Tomcat的方法

http://vod.sjtu.edu.cn/help/Article_Show.asp?ArticleID=626

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值