Manage sqlite sync and shared datastore in ha mode
This commit is contained in:
26
preservice/31-one-ha
Executable file
26
preservice/31-one-ha
Executable file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
HA=$(CreoleGet activer_one_ha non)
|
||||
DBMODE=$(CreoleGet one_database_type "none")
|
||||
LEADER_DB_FILE="/var/lib/one/one.db.leader"
|
||||
DBFILE="/var/lib/one/one.db"
|
||||
|
||||
# If HA is enabled and a leader database file is present
|
||||
# we restore the leader database.
|
||||
|
||||
if [[ ${HA} == "oui" ]] && [[ ${DBMODE} == "sqlite" ]]
|
||||
then
|
||||
if [[ -f ${LEADER_DB_FILE} ]]
|
||||
then
|
||||
if [[ $(CreoleGet one_ha_server_index) != "0" ]]
|
||||
then
|
||||
onedb restore --sqlite ${DBFILE} ${LEADER_DB_FILE} -f
|
||||
if [[ $? -eq 0 ]]
|
||||
then
|
||||
rm ${LEADER_DB_FILE}
|
||||
exit ${?}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
exit 0
|
Reference in New Issue
Block a user