添加tomcat用戶組tomcat
/usr/sbin/groupadd tomcatbash
添加tomcat用戶,並限制登陸ide
/usr/sbin/useradd -s /bin/bash -g tomcat tomcatspa
/usr/sbin/usermod -L tomcat #鎖定密碼,使密碼無效orm
修改目錄全部者:ip
#chown -R tomcat:tomcat /usr/local/tomcatit
#vi /etc/init.d/tomcat io
#!/bin/bash # description: Startup Script for tomcat # /etc/rc.d/init.d/tomcat #JDK Settings export JAVA_HOME=/usr/local/jdk1.8.0_60 ###根據須要修改此處 export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar export PATH=$PATH:$JAVA_HOME/bin case "$1" in start) echo "Starting tomcat: " #以tomcat用戶身份運行 根據須要修改此處 su -c /usr/local/tomcat/bin/./startup.sh tomcat echo "OK......tomcat started" ;; stop) echo "Shutdown tomcat: " /usr/local/tomcat/bin/./shutdown.sh echo "OK.....tomcat stoped" ;; *) echo "Usage: 'basename $0' start|stop" exit 1 esac exit 0
給啓動命令執行權限class
chmod 777 /etc/init.d/tomcat登錄
啓動tomcat
/etc/init.d/tomcat start
關閉tomcat
/etc/init.d/tomcat stop