@ -69,10 +69,6 @@ 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
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( ) {
do_secondary( ) {
@ -86,20 +82,22 @@ do_secondary() {
warning " The primary ( ${ primary } ) is on the network but --force specified. Proceeding anyway. "
warning " The primary ( ${ primary } ) is on the network but --force specified. Proceeding anyway. "
fi
fi
fi
fi
verbose " Expanding package from the primary"
verbose " Checking for package from the primary"
syncfile = $( basename ` ls -tr1 ${ backupDir } /${ syncname } * | tail -1` )
syncfile = $( basename ` ls -tr1 ${ backupDir } /${ syncname } * | tail -1` )
[ -z " $syncfile " ] && error " No sync file ( $syncfile ) found. " && exit 2
fullfile = " /store/backups/nagiosxi/ $syncfile "
/home/nagios/bin/rsync_xi.sh --primary " ${ primary } " --secondary " ${ secondary } " --file " /store/backups/nagiosxi/ $syncfile "
if [ -f " $fullfile " ] ; then
if [ $? -eq 0 ] ; then
verbose " Sync file found ( $fullfile ). Continuing. "
sleep 2
/home/nagios/bin/rsync_xi.sh --primary " ${ primary } " --secondary " ${ secondary } " --file " $fullfile "
if [ -r "/usr/local/nagiosxi/html/includ es/components/custom-inc ludes/c ss/head er-gradient.css.secondary" -a -w "/usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css" ] ; then
else
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
warning " No sync file found. Continuing to activate Nagios."
fi
fi
if [ $? -eq 0 ] ; then
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 "This is intended to be manually executed when needed, so we assume you want to start Nagios..." -n
sleep 5
start_nagios
start_nagios
rm -f ${ sync file}
rm -f ${ full file}
verbose "Done."
verbose "Done."
fi
fi
}
}