tomcat加入service启动,非root用户启动tomcat

yum install jpackage-utils

yum install redhat-lsb 


启动文件

 

拷贝tomcat6、tomcat6-1、tomcat6-1.conf文件到相应目录,并命名成相应名称(见附件)

服务:/etc/init.d/tomcat6-1

配置:/etc/tomcat6/tomcat6-1.conf   注意修改启动内存 加到/etc/tomcat6/tomcat6-1.conf

依赖脚本:/usr/sbin/tomcat6   此文件无需修改

 

配置

 

1. /etc/tomcat6/tomcat6-1.conf文件

 

# Where your tomcat installation lives
CATALINA_BASE="/data/app/tomcat-6.0.44"
CATALINA_HOME="/data/app/tomcat-6.0.44"
CATALINA_TMPDIR="/data/app/tomcat-6.0.44"
JASPER_HOME="/data/app/tomcat-6.0.44/temp"

#tomcat安装目录,需要改地址

 

# What user should run tomcat
TOMCAT_USER="tomcat"  #启动用户

# Set the TOMCAT_PID location
CATALINA_PID="/var/run/tomcat6/tomcat6.pid"



2. /etc/init.d/tomcat6-1文件

# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG="/etc/tomcat6/tomcat6-1.conf"

# Path to the tomcat launch script
TOMCAT_SCRIPT="/usr/sbin/tomcat6"

启动前准备

添加tomcat用户

useradd tomcat -M -s /sbin/nologin

 

变更一下目录属主与属组为tomcat

chown -R tomcat:tomcat /data/app/tomcat-...

chown -R tomcat:tomcat /data/data/app-log/

chown -R tomcat:tomcat /var/run/tomcat6 #需要创建

 

chmod +x /etc/init.d/tomcat_01

chmod +x /usr/sbin/tomcat6

 

启动

service tomcat6-1 start


你可能感兴趣的:(tomcat,service,启动非root)