comparing rancid files on two different servers

Usually, I just use rsync to keep files in sync, but this runs through all of the files.

Starting on server #1, inside the rancid base directory (/var/lib/rancid for me),
with $LIST_OF_GROUPS from /etc/rancid/rancid.conf,
using ssh with port 2022 ,
$REMOTE = DNS name of remote server :

for i in $LIST_OF_GROUPS ; do echo $i ; rsync -n -i -e 'ssh -p 2022' /var/lib/rancid/$i/router.db $REMOTE:/var/lib/rancid/$i/router.db ; done

To run vimdiff to see or manually sync a single file:

vimdiff /var/lib/rancid/ABC/router.db scp://$REMOTE_SRV:2022//var/lib/rancid/ABC/router.db

Note that this uses 2022 as an alternate ssh port for scp (as called by vimdiff).

The automated sync operation is actually done from jenkins. This is probably not the ideal formula, but for self-documnetation purposes, here it is:

crontab on server1 to remote server2. (REMOTE_SRV = server2’s DNS name)
to copy files from server1 to remote server2.

@daily export JENKINS_HOME=http://JENKINS.brunhilda.edu:8080 ; java -jar /usr/share/jenkins/external-job-monitor/java/jenkins-core-*.jar "rancid_sync srv1 to srv2" rsync --exclude 'configs' --exclude 'bin' --exclude 'logs' --exclude 'CVS' --compress --itemize-changes -Cavh -e 'ssh -p 2022' --checksum $REMOTE_SRV:/var/lib/rancid/ /var/lib/rancid/

Tags: , , , ,

Leave a Reply

You must be logged in to post a comment.