一、设置dubbo监控中心开机自启
1、先cd /etc/init.d
目录下
2、编辑vi dubbo-admin
复制下边的脚本进去
3、注意修改路径CATALANA_HOME=/opt/apache-tomcat-8.5.24
export JAVA_HOME=/opt/jdk1.8.0_152
4、利用命令chkconfig --add dubbo-admin
加入服务即可!
5、service dubbo-admin start
测试开启服务
dubbo-admin 开机自启的脚本:
#!/bin/bash
#chkconfig:2345 20 90
#description:dubbo-admin
#processname:dubbo-admin
CATALANA_HOME=/opt/apache-tomcat-8.5.24
export JAVA_HOME=/opt/jdk1.8.0_152
case $1 in
start)
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..."
二、设置zookeeper注册中心开机自启
1、先cd /etc/init.d
目录下
2、编辑vi zookeeper
复制下边的脚本进去
3、注意修改路径CATALANA_HOME=/opt/zookeeper-3.4.11
export JAVA_HOME=/opt/jdk1.8.0_152
4、利用命令chkconfig --add zookeeper
加入服务即可!
5、service zookeeper start
测试开启服务
Zookeeper开机自启的脚本:
#!/bin/bash
#chkconfig:2345 20 90
#description:zookeeper
#processname:zookeeper
ZK_PATH=/opt/zookeeper-3.4.11
export JAVA_HOME=/opt/jdk1.8.0_152
case $1 in
start) sh $ZK_PATH/bin/zkServer.sh start;;
stop) sh $ZK_PATH/bin/zkServer.sh stop;;
status) sh $ZK_PATH/bin/zkServer.sh status;;
restart) sh $ZK_PATH/bin/zkServer.sh restart;;
*) echo "require start|stop|status|restart" ;;
esac
之后把Tomcat进程和zookeeper进程kill -9
关掉,再开机试试吧!