You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.6 KiB
50 lines
1.6 KiB
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
rm -rf results
|
|
mkdir results
|
|
|
|
if ! [[ -r /etc/ngcp-backup-tools/db-backup.conf ]]; then
|
|
echo "Cannot read mandatory config file /etc/ngcp-backup-tools/db-backup.conf" 2>&1
|
|
exit 1
|
|
fi
|
|
. /etc/ngcp-backup-tools/db-backup.conf
|
|
|
|
location="$(dirname "$0")"
|
|
version="$(cat /etc/ngcp_version)"
|
|
case "${version}" in
|
|
2.8|3.*|mr[3-7].*|mr8.0.*)
|
|
if [[ ! -r /etc/mysql/sipwise.cnf ]]; then
|
|
echo "Cannot read mandatory config file /etc/mysql/sipwise.cnf" 2>&1
|
|
exit 1
|
|
fi
|
|
. /etc/mysql/sipwise.cnf
|
|
for db in "${NGCP_DB_BACKUP_FINAL_LIST[@]}"; do
|
|
"${location}/compare_dbs.pl" \
|
|
--result="results/result_${db}.tap" \
|
|
--connect_db1="DBI:mysql:database=${db};host=sp1" \
|
|
--user_db1='sipwise' \
|
|
--pass_db1="${SIPWISE_DB_PASSWORD}" \
|
|
--connect_db2="DBI:mysql:database=${db};host=sp2" \
|
|
--user_db2='sipwise' \
|
|
--pass_db2="${SIPWISE_DB_PASSWORD}" \
|
|
|| true
|
|
done
|
|
;;
|
|
*)
|
|
MYSQL_CREDENTIALS='/etc/mysql/sipwise_extra.cnf'
|
|
if [[ ! -r "${MYSQL_CREDENTIALS}" ]]; then
|
|
echo "Cannot read mandatory config file '${MYSQL_CREDENTIALS}'" 2>&1
|
|
exit 1
|
|
fi
|
|
for db in "${NGCP_DB_BACKUP_FINAL_LIST[@]}"; do
|
|
"${location}/compare_dbs.pl" \
|
|
--result="results/result_${db}.tap" \
|
|
--connect_db1="DBI:mysql:database=${db};host=sp1;mysql_read_default_file=${MYSQL_CREDENTIALS}" \
|
|
--connect_db2="DBI:mysql:database=${db};host=sp2;mysql_read_default_file=${MYSQL_CREDENTIALS}" \
|
|
|| true
|
|
done
|
|
;;
|
|
esac
|