#!/bin/sh
SERVICE_NAME=example
VERSION=1.5.3
if [ ! -d ./logs ]; then
mkdir logs
fi
if [ "$1" == "nacos" ]; then
REGISTER_CENTER="nacos"
REGISTER_CENTER_PARAM="--spring.autoconfigure.exclude=org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration --spring.main.allow-bean-definition-overriding=true"
else
REGISTER_CENTER="eureka"
REGISTER_CENTER_PARAM="--spring.cloud.nacos.config.enabled=false --spring.cloud.nacos.discovery.enabled=false --spring.main.allow-bean-definition-overriding=true"
fi
echo "${SERVICE_NAME} starting as ${REGISTER_CENTER} client ..."
nohup java -jar -Djava.net.preferIPv4Stack=false ${SERVICE_NAME}-${VERSION}.jar $REGISTER_CENTER_PARAM > ./logs/$SERVICE_NAME.log 2>&1 &
echo "${SERVICE_NAME} started ok"
#tail -f ${SERVICE_NAME}.log