1. cd /etc/init.d
2. vi tomcat8_8081
3.粘贴自启动命令 注意替换自己的Java环境变量和 TOMCAT的HOME
#!/bin/bash
#
# tomcat startup script for the Tomcat server
#
# chkconfig: 345 80 20
# description: start the tomcat deamon
#
# Source function library
. /etc/rc.d/init.d/functions
prog=tomcat8_8081
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el6_8.x86_64/jre
export JAVA_HOME
CATALANA_HOME=/usr/local/items/server/tomcat8_8081
export CATALINA_HOME
case "$1" in
start)
echo "Starting Tomcat8081..."
$CATALANA_HOME/bin/startup.sh
;;
stop)
echo "Stopping Tomcat8081..."
$CATALANA_HOME/bin/shutdown.sh
;;
restart)
echo "Stopping Tomcat8081..."
$CATALANA_HOME/bin/shutdown.sh
sleep 2
echo
echo "Starting Tomcat8081..."
$CATALANA_HOME/bin/startup.sh
;;
*)
echo "Usage: $prog {start|stop|restart}"
;;
esac
exit 0
4. :wq 保存退出
5.chmod 755 tomcat8_8081 赋权限
6.service tomcat8_8081 start 启动检查
7. chkconfig tomcat8_8081 on 设置开机自启动