diff --git a/failover/failover.sh b/failover/failover.sh index d1f2182..7f889be 100755 --- a/failover/failover.sh +++ b/failover/failover.sh @@ -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`) + 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 - /home/nagios/bin/rsync_xi.sh --primary "${primary}" --secondary "${secondary}" --file "/store/backups/nagiosxi/$syncfile" 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."