24 lines
572 B
Bash
24 lines
572 B
Bash
#!/bin/sh
|
|
|
|
PLATFORM=${PLATFORM:-"vm"}
|
|
SLEEP_TIME=${SLEEP_TIME:-"5"}
|
|
MAX_RETRY=${MAX_RETRY:-"10"}
|
|
RETRY=1
|
|
|
|
# check loaded status
|
|
# @param $1 : platform's key
|
|
check_status()
|
|
{
|
|
ETCD_READY=$(etcdctl --endpoints http://etcd:2379 get /${1}/etcd/loaded)
|
|
}
|
|
|
|
# ETCDCTL_API=3 should be defined as a global variable
|
|
check_status ${PLATFORM}
|
|
while [[ -z "${ETCD_READY}" && ${RETRY} -le ${MAX_RETRY} ]]; do
|
|
echo "Waiting for ECTD init ... (try number ${RETRY})";
|
|
check_status ${PLATFORM}
|
|
sleep ${SLEEP_TIME};
|
|
|
|
RETRY=$(expr ${RETRY} + 1)
|
|
done
|
|
echo "ECTD init ready." |