#!/bin/bash
tmp_file=`curl -X GET '127.0.0.1:8848/nacos/v1/ns/service/list?pageNo=1&pageSize=20'`
echo $tmp_file
str2="blade-system blade-auth blade-gateway blade-resource mes-product mes-warehouse mes-admin mes-qms"
for i in $str2
do
res=$(echo $tmp_file | grep "$i")
if [[ "$res" != "" ]]
then
    echo -e "\033[32m $i已在nacos中注册，$i启动正常 \033[0m"
else
    echo -e "\033[31m $i未在nacos中注册，$i启动异常 \033[0m"
    echo -e "\033[32m 正在重启$i \033[0m"
    docker restart `docker ps | grep $i | awk '{print $1}'`
    echo -e "\033[32m $i已完成重启 \033[0m" 
fi
done
