因dubbo服务脏路由导致服务启停时间延长
#!/bin/bash
DATE=`date "+%Y-%m-%d_%H_%M"`
#########zkCli#################
ZK_IP="$1"
ZK_PORT="$2"
ZKCli_DIR=/app/dubbo/zookeeper-3.4.6/bin
#########file1为备份###########
Delroute_bak=/app/zookeeper/route/delroute_bak
#########file2为黑名单#########
Black_list=/app/zookeeper/route/file2
Black_DIR=/app/zookeeper/route
########zookeeper路径################
ZK_DIR=/app/dubbo/zookeeper-3.4.6/bin
#########检查是否添加变量######
if [[ ! -n "${ZK_IP}" || ! -n "${ZK_PORT}" ]];then
exit
fi
#########检查是否有对比文件####
if [[ ! -e ${Black_list} ]];then
touch ${Black_list}
fi
if [[ ! -d ${Black_DIR} ]];then
mkdir -p ${Black_DIR}
fi
if [[ ! -d ${Black_DIR}/route_bak ]];then
mkdir -p ${Black_DIR}/route_bak
fi
if [[ ! -f ${Delroute_bak} ]];then
touch ${Delroute_bak}
else
mv ${Delroute_bak} ${Black_DIR}/route_bak/route_bak${DATE}
fi
#########删除路由脚本##########
Delroute_