一、在/etc/init.d/下新建tomcat文件
vim /etc/init.d/tomcat
写入如下脚本
#!/bin/bash
#description:  start stop restart
#processname: Tomcat
#chkconfig: 234 20 80
export JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat-xxxxx
case  $1 in 
              start)
                     sh $CATALINA_HOME/bin/startup.sh
                     ;;
              stop)
                     sh $CATALINA_HOME/bin/shutdown.sh
                     ;;
            restart)
                     sh $CATALINA_HOME/bin/shutdown.sh
                     sh $CATALINA_HOME/bin/startup.sh
                     ;;
                  *)
                                   echo 'please use: tomcat {start | stop | restart}'
                     ;;                  
esac
exit 0
二、赋予tomcat文件权限
chmod +x /etc/init.d/tomcat
三、配置开机启动
启动:service tomcat start
停止:service tomcat stop
重启:service tomcat restart
chkconfig --add tomcat
chkconfig tomcat on
关闭tomcat服务自启动:chkconfig tomcat off
删除tomcat服务在chkconfig上的管理:chkconfig –del tomcat