本文主要是介绍Jsvc守护进程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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这篇关于Jsvc守护进程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!