Jsvc守护进程

来源:互联网 发布:淘宝代理流程 编辑:程序博客网 时间:2024/04/29 09:39

1.添加tomcat用户及用户组

[root@V_wangshenweb01 ~]# groupadd tomcat

[root@V_wangshenweb01 ~]# useradd -g tomcat tomcat

2.改变tomcat的用户及用户组

[root@V_wangshenweb01 ~]# chown -R tomcat  /usr/local/tomcat

[root@V_wangshenweb01 ~]# chgrp -R tomcat  /usr/local/tomcat

3.切换用户为tomcat

[root@V_wangshenweb01 ~]# su  tomcat

4.进入tomcat下的bin目录,解压commons-daemon-native.tar.gz

[tomcat@V_wangshenweb01 bin]# cd /usr/local/tomcat7.0.57/bin/

[tomcat@V_wangshenweb01 bin]# tar -zxvf commons-daemon-native.tar.gz

5.得到文件commons-daemon-1.0.15-native-src,进入nuix目录

[tomcat@V_wangshenweb01 bin]# cd commons-daemon-1.0.15-native-src/unix/

6.发现configure配置文件并编译,做如下操作

[tomcat@V_wangshenweb01 unix]# chmod 777 configure

[tomcat@V_wangshenweb01 unix]# ./configure

[tomcat@V_wangshenweb01 unix]# make

7.编译完成后出现jsvc文件夹 复制到/usr/local/tomcat7.0.57/bin

[tomcat@V_wangshenweb01 unix]# cp jsvc /usr/local/tomcat7.0.57/bin

8.把bin目录下的daemon.sh复制到/etc/init.d/tomcat

注:此时要把用户切换为root,否则会提示权限不够

[root@V_wangshenweb01 bin]# cp ./daemon.sh /etc/init.d/tomcat

9.修改/etc/init.d/tomcat

[root@V_wangshenweb01 bin]# vi etc/init.d/tomcat

#!/bin/sh下添加以下内容

# chkconfig:2334 90 15

# description Tomcat-en Manager

# resolve links - $0 may be a softlink下添加以下内容

#jdk的位置

JAVA_HOME=/usr/java/jdk1.7.0_79

#tomcat的位置

CATALINA_HOME=/usr/local/tomcat

DAEMON_HOME=$CATALINA_HOME/bin

#使用tomcat身份启动

TOMCAT_USER=tomcat

CATALINA_BASE=$CATALINA_HOME

CATALINA_OPTS="-server -XX:MaxPermSize=512m -XX:MaxNewSize=512m -Xmx2048m"

保存并退出(wq

7.更改tomcat权限

[root@V_wangshenweb01 bin]# chmod 777 /etc/init.d/tomcat

8.添加tomcat服务

[root@V_wangshenweb01 bin]# chkconfig --add tomcat

9.查看服务

[root@V_wangshenweb01 bin]# chkconfig --list|grep tomcat

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

10.启动tomcat

[tomcat@V_wangshenweb01 bin]# service tomcat start

[tomcat@V_wangshenweb01 bin]# service tomcat stop
原创粉丝点击