2019-02-22 14:47:20 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-02-22 17:16:04 +01:00
|
|
|
function init_ha_leader() {
|
2019-02-22 14:47:20 +01:00
|
|
|
# server with index 1 exists if already instanciate
|
|
|
|
onezone show 0 | grep -A 3 ^"HA & FEDERATION SYNC STATUS" | tail -n 1 | grep -q ^" 1 "
|
|
|
|
if [ ! $? = 0 ]; then
|
|
|
|
FOLLOWER=$(CreoleGet one_nodes)
|
|
|
|
for follower in $FOLLOWER; do
|
|
|
|
onezone server-add 0 --name $follower --rpc http://$follower:2633/RPC2
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$(CreoleGet activer_one_ha)" = "oui" ]; then
|
|
|
|
if [ "$(CreoleGet one_ha_server_index)" = "0" ]; then
|
2019-02-22 17:16:04 +01:00
|
|
|
init_ha_leader
|
2019-02-22 14:47:20 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|