change tab to 4 spaces + add ssh-keyscan
This commit is contained in:
parent
10369f18f9
commit
d7a4769ec0
|
@ -28,6 +28,7 @@ EOF
|
|||
REMOTEKEY=$(su - oneadmin -c "ssh ${host} 'cat ~oneadmin/.ssh/id_rsa.pub'")
|
||||
if ! grep -qs "$REMOTEKEY" ~oneadmin/.ssh/authorized_keys; then
|
||||
su - oneadmin -c "echo ${REMOTEKEY} >> ~oneadmin/.ssh/authorized_keys"
|
||||
su - oneadmin -c "ssh-keyscan $host"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -46,20 +47,20 @@ function copy_files()
|
|||
function sync_db()
|
||||
{
|
||||
local ip=${1}
|
||||
local user="oneadmin"
|
||||
local DBFILE="/var/lib/one/one.db"
|
||||
local DBBCK="/tmp/one.db.bck"
|
||||
local ret=0
|
||||
local user="oneadmin"
|
||||
local DBFILE="/var/lib/one/one.db"
|
||||
local DBBCK="/tmp/one.db.bck"
|
||||
local ret=0
|
||||
|
||||
if [[ ! -f ${DBBCK} ]]
|
||||
then
|
||||
cmd="onedb backup --sqlite ${DBFILE} ${DBBCK}"
|
||||
ret=$(su - ${user} -c -- "${cmd}")
|
||||
fi
|
||||
if [[ ! -f ${DBBCK} ]]
|
||||
then
|
||||
cmd="onedb backup --sqlite ${DBFILE} ${DBBCK}"
|
||||
ret=$(su - ${user} -c -- "${cmd}")
|
||||
fi
|
||||
|
||||
cmd2="scp ${DBBCK} ${ip}:${DBFILE}.leader"
|
||||
ret=$(su - ${user} -c -- "${cmd2}")
|
||||
return ${?}
|
||||
cmd2="scp ${DBBCK} ${ip}:${DBFILE}.leader"
|
||||
ret=$(su - ${user} -c -- "${cmd2}")
|
||||
return ${?}
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -69,10 +70,10 @@ function sync_db()
|
|||
#
|
||||
function sync_nodes()
|
||||
{
|
||||
# Need to sync hosts with rsync after creation, ONE 5.6.1 bug
|
||||
cmd2="onehost sync -f --rsync"
|
||||
ret2=$(su - ${ONEUSER} -c -- "${cmd2}")
|
||||
return ${?}
|
||||
# Need to sync hosts with rsync after creation, ONE 5.6.1 bug
|
||||
cmd2="onehost sync -f --rsync"
|
||||
ret2=$(su - ${ONEUSER} -c -- "${cmd2}")
|
||||
return ${?}
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -196,17 +197,17 @@ for host in ${HAPY_SLV}; do
|
|||
EchoVert " * Enregistrement du noeud"
|
||||
register_node ${host}
|
||||
# wait_node_ok ${host}
|
||||
if [[ ${HAPY_HA} == "oui" ]]
|
||||
then
|
||||
if [[ $DBMODE == "sqlite" ]]
|
||||
then
|
||||
if [[ $(CreoleGet one_ha_server_index) == "0" ]]
|
||||
then
|
||||
sync_db ${host}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
sync_nodes
|
||||
if [[ ${HAPY_HA} == "oui" ]]
|
||||
then
|
||||
if [[ $DBMODE == "sqlite" ]]
|
||||
then
|
||||
if [[ $(CreoleGet one_ha_server_index) == "0" ]]
|
||||
then
|
||||
sync_db ${host}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
sync_nodes
|
||||
wait_node_ok ${HAPY_SLV[${i}]}
|
||||
if [[ ${?} -ne 0 ]]
|
||||
then
|
||||
|
|
Loading…
Reference in New Issue