|
|
|
|
@ -69,10 +69,6 @@ do_primary() {
|
|
|
|
|
[ $? -ne 0 ] && error "Cannot ping ${secondary}. Use --noping to continue wihout ping." && exit
|
|
|
|
|
verbose "Creating package to send to secondary"
|
|
|
|
|
/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
|
|
|
|
|
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
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do_secondary() {
|
|
|
|
|
@ -86,20 +82,22 @@ 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
|
|
|
|
|
/home/nagios/bin/rsync_xi.sh --primary "${primary}" --secondary "${secondary}" --file "/store/backups/nagiosxi/$syncfile"
|
|
|
|
|
fullfile="/store/backups/nagiosxi/$syncfile"
|
|
|
|
|
if [ -f "$fullfile" ]; then
|
|
|
|
|
verbose " Sync file found ($fullfile). Continuing."
|
|
|
|
|
/home/nagios/bin/rsync_xi.sh --primary "${primary}" --secondary "${secondary}" --file "$fullfile"
|
|
|
|
|
else
|
|
|
|
|
warning " No sync file found. Continuing to activate Nagios."
|
|
|
|
|
fi
|
|
|
|
|
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 5
|
|
|
|
|
start_nagios
|
|
|
|
|
rm -f ${syncfile}
|
|
|
|
|
rm -f ${fullfile}
|
|
|
|
|
verbose "Done."
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|