From b137eb990f6933ecaf62a08020f6607cd0941941 Mon Sep 17 00:00:00 2001 From: Eric Loyd Date: Fri, 7 Jan 2022 09:50:00 -0500 Subject: [PATCH] Updated failover to fix key file permission and save program URL --- failover/failover.sh | 2 ++ failover/rsync_xi.sh | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/failover/failover.sh b/failover/failover.sh index 529e26c..d1f2182 100755 --- a/failover/failover.sh +++ b/failover/failover.sh @@ -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} diff --git a/failover/rsync_xi.sh b/failover/rsync_xi.sh index 74a06ea..148bebe 100755 --- a/failover/rsync_xi.sh +++ b/failover/rsync_xi.sh @@ -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":"`