跟上一篇添加zookeeper为服务基本类似
脚本如下:
#!/bin/bashCATALANA_HOME=/usr/local/tomcat8export JAVA_HOME=/usr/local/javacase $1 instart) echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;;stop) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh ;;restart) echo "Stopping Tomcat..." $CATALANA_HOME/bin/shutdown.sh sleep 2 echo echo "Starting Tomcat..." $CATALANA_HOME/bin/startup.sh ;;*) echo "Usage: tomcat {start|stop|restart}" ;; esac
注意:
若chkconfig -add 提示错误
添加
#chkconfig:2345 20 90
2、3、4、5 级别都启动,开启序号21 关闭断序号90