eole-one-master/postservice/99-z-ha

21 lines
556 B
Plaintext
Raw Normal View History

2019-02-22 14:47:20 +01:00
#!/usr/bin/env bash
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
init_ha_leader
2019-02-22 14:47:20 +01:00
fi
fi
exit 0