You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/script/docker_check_service.sh

34 lines
890 B

#!/usr/bin/env bash
source ./style_info.cfg
docker_compose_components=(
etcd
mongo
mysql
open_im_server
redis
kafka
zookeeper
)
component_server_count=0
for ((i = 0; i < ${#docker_compose_components[*]}; i++)); do
component_server="docker-compose ps|grep -w ${docker_compose_components[$i]}|grep Up"
count="${component_server}|wc -l"
if [ $(eval ${count}) -gt 0 ]; then
echo -e "${SKY_BLUE_PREFIX}docker-compose ${docker_compose_components[$i]} is Up!${COLOR_SUFFIX}"
let component_server_count+=1
else
echo -e "${RED_PREFIX} ${docker_compose_components[$i]} start failed!${COLOR_SUFFIX}"
fi
done
if [ ${component_server_count} -eq 7 ]; then
echo -e "${YELLOW_PREFIX}\ndocker-compose all services is Up!${COLOR_SUFFIX}"
else
echo -e "${RED_PREFIX}\nsome docker-compose services start failed,please check red logs on console ${COLOR_SUFFIX}"
fi