From e0a5c30453368eeb0acfceec917184c9e0c28fa7 Mon Sep 17 00:00:00 2001 From: Eric Loyd Date: Thu, 5 May 2022 14:11:15 -0400 Subject: [PATCH] We should now be ignoring the CSS file --- failover/README.md | 8 ++++++++ failover/rsync_xi.sh | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/failover/README.md b/failover/README.md index ed66ec0..0387ea1 100644 --- a/failover/README.md +++ b/failover/README.md @@ -21,3 +21,11 @@ Failover from primary Nagios XI to secondary Nagios XI is a Disaster Recovery ef * Make sure any ramdisk (such as /ramdisk) is copied if it exists * Note that any gearman addons such as /etc/mod_gearman or whatever are NOT copied as part of this procedure. These types of things need to be set up on both boxes the same way before this process is set up. + +## Running from cron +The synchronization script should run on the primary at regular intervals to keep the secondary as up-to-date as possible. It is recommended to run the script from cron to accomplish this. At the simplest level, one could do this: +* */30 * * * * /home/nagios/bin/SYNC >> /home/nagios/sync.log + +To include a timestamp, this would work: + +* */30 * * * * (date; /home/nagios/bin/SYNC) >> /home/nagios/sync.log diff --git a/failover/rsync_xi.sh b/failover/rsync_xi.sh index 9f599eb..2533d1f 100755 --- a/failover/rsync_xi.sh +++ b/failover/rsync_xi.sh @@ -18,6 +18,7 @@ execute="-n" syncfile="" isP=/bin/false isS=/bin/false +rsync_opts="-a --delete --delete-after --rsync-path=\"sudo /bin/rsync\" --exclude=/usr/local/nagiosxi/html/includes/components/custom-includes/css/header-gradient.css" # Import Nagios XI and xi-sys.cfg config vars . $BASEDIR/../var/xi-sys.cfg @@ -120,8 +121,8 @@ do_rsync() { verbose "Syncing $*..." src="$1" [ ! -e "$src" ] && warning " OK: No such file or directory: $src" && return - [ -d "$src" ] && sudo rsync -a --delete --delete-after --rsync-path="sudo /bin/rsync" ${execute} ${src}/ nagios@${sName}:${src}/ - [ -f "$src" ] && sudo rsync -a --delete --delete-after --rsync-path="sudo /bin/rsync" ${execute} ${src} nagios@${sName}:${src} + [ -d "$src" ] && sudo rsync ${rsync_opts} ${execute} ${src}/ nagios@${sName}:${src}/ + [ -f "$src" ] && sudo rsync ${rsync_opts} ${execute} ${src} nagios@${sName}:${src} } do_backup_files() {