Updated failover to fix key file permission and save program URL

release-2.5.18
Eric Loyd 4 years ago
parent 56123a8e43
commit b137eb990f

@ -95,6 +95,8 @@ do_secondary() {
if [ -r "/usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css.secondary" -a -w "/usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css" ]; then
cp /usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css.secondary /usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css
fi
chmod 0640 /usr/local/nagiosxi/var/keys/xi.key
chown nagios:nagios /usr/local/nagiosxi/var/keys/xi.key
verbose "This is intended to be manually executed when needed, so we assume you want to start Nagios..." -n
start_nagios
rm -f ${syncfile}

@ -344,12 +344,16 @@ do
x=$(($x+1))
done
# Save old Program URL
old_url=$(echo "select value from xi_options where name='url'" | mysql -h "$ndoutils_dbserver" --port="$ndoutils_dbport" -u root --password=$mysqlpass -N nagiosxi)
mysql -h "$ndoutils_dbserver" --port="$ndoutils_dbport" -u root --password=$mysqlpass < $backupdir/mysql/nagios.sql
res=$?
if [ $res != 0 ]; then
error "Error restoring MySQL database 'nagios'"
exit 1
fi
# Restore old Program URL
echo "update xi_options set value='$old_url' where nam=e'url'" | mysql -h "$ndoutils_dbserver" --port="$ndoutils_dbport" -u root --password=$mysqlpass -N nagiosxi)
if [[ "$cfg__db_info__nagiosql__dbserver" == *":"* ]]; then
nagiosql_dbport=`echo "$cfg__db_info__nagiosql__dbserver" | cut -f2 -d":"`

Loading…
Cancel
Save