header.css work is now performed in failover.sh instead of rsync, since sometimes you just want to activate failover

test
Eric Loyd 4 years ago
parent 83087d5c04
commit 1dd87e1c39

@ -18,6 +18,7 @@ secondary=""
synconly="false" synconly="false"
syncname="sync" syncname="sync"
extraCmd="" extraCmd=""
cssDir="/usr/local/nagiosxi/html/includes/components/custom-includes/css/"
hostname=`/bin/hostname` hostname=`/bin/hostname`
@ -69,9 +70,10 @@ do_primary() {
[ $? -ne 0 ] && error "Cannot ping ${secondary}. Use --noping to continue wihout ping." && exit [ $? -ne 0 ] && error "Cannot ping ${secondary}. Use --noping to continue wihout ping." && exit
verbose "Creating package to send to secondary" verbose "Creating package to send to secondary"
/home/nagios/bin/rsync_xi.sh --prepend ${syncname} --primary "${primary}" --secondary "${secondary}" $extraCmd /home/nagios/bin/rsync_xi.sh --prepend ${syncname} --primary "${primary}" --secondary "${secondary}" $extraCmd
if [ -r "/usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css.primary" -a -w "/usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css" ]; then # Update header.css with proper gradient files
if [ -r "${cssDir}/header.css.primary" -a -w "${cssDir}/header.css" ]; then
verbose "Copying local gradient files" verbose "Copying local gradient files"
cp /usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css.primary /usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css cp ${cssDir}/header.css.primary ${cssDir}/header.css
fi fi
} }
@ -91,13 +93,18 @@ do_secondary() {
[ -z "$syncfile" ] && error "No sync file ($syncfile) found." && exit 2 [ -z "$syncfile" ] && error "No sync file ($syncfile) found." && exit 2
/home/nagios/bin/rsync_xi.sh --primary "${primary}" --secondary "${secondary}" --file "/store/backups/nagiosxi/$syncfile" /home/nagios/bin/rsync_xi.sh --primary "${primary}" --secondary "${secondary}" --file "/store/backups/nagiosxi/$syncfile"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
sleep 2 # Update header.css with proper gradient files
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 if [ -r "${cssDir}/header.css.secondary" -a -w "${cssDir}/header.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 verbose "Copying local gradient files"
cp ${cssDir}/header.css.secondary ${cssDir}/header.css
fi fi
verbose "Ensuring that xi.key file has proper permissions"
chmod 0640 /usr/local/nagiosxi/var/keys/xi.key chmod 0640 /usr/local/nagiosxi/var/keys/xi.key
chown nagios:nagios /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 verbose "***"
warning "***"
error "***"
warning "This is intended to be manually executed when needed, so we assume you want to start Nagios..." -n
start_nagios start_nagios
rm -f ${syncfile} rm -f ${syncfile}
verbose "Done." verbose "Done."

@ -500,9 +500,6 @@ do_secondary() {
[ ! -r "$syncfile" ] && error "No sync file ($syncfile) found." && exit 2 [ ! -r "$syncfile" ] && error "No sync file ($syncfile) found." && exit 2
restore_secondary "$syncfile" restore_secondary "$syncfile"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
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
rm -f ${syncfile} rm -f ${syncfile}
fi fi
} # End of do_secondary } # End of do_secondary

Loading…
Cancel
Save