Update failover/failover.sh

Removed header.css code, added code to skip the sync if the sync file doesn't exist, and sleep for 2 seconds before trying to start Nagios.
release-2.6.13
Eric Loyd 4 years ago
parent c4bb0d893c
commit b5256e83ea

@ -86,18 +86,21 @@ do_secondary() {
warning "The primary (${primary}) is on the network but --force specified. Proceeding anyway."
fi
fi
verbose "Expanding package from the primary"
verbose "Checking for package from the primary"
syncfile=$(basename `ls -tr1 ${backupDir}/${syncname}* | tail -1`)
[ -z "$syncfile" ] && error "No sync file ($syncfile) found." && exit 2
if [ -r "$syncfile" ]; then
verbose " Sync file found (/store/backups/nagiosxi/$syncfile). Continuing."
/home/nagios/bin/rsync_xi.sh --primary "${primary}" --secondary "${secondary}" --file "/store/backups/nagiosxi/$syncfile"
else
warning " No sync file found. Continuing to activate Nagios."
fi
[ -z "$syncfile" ] && error "No sync file ($syncfile) found." && exit 2
if [ $? -eq 0 ]; then
sleep 2
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
sleep 2
start_nagios
rm -f ${syncfile}
verbose "Done."

Loading…
Cancel
Save