Skip to content

Instantly share code, notes, and snippets.

@dogsbody
Created May 24, 2012 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogsbody/2784525 to your computer and use it in GitHub Desktop.
Save dogsbody/2784525 to your computer and use it in GitHub Desktop.
Create a file from BlueOnyx of all the primary domains hosted to push to a secondary
#!/bin/sh
##############################################################################
# #
# Pushes all the domains to the secondary servers #
# Version 1.20 #
# Lasted Edited on 24 May 2012 #
# Contact Dan Benton at dan@dogsbodytechnology.com #
# Or visit me at http://www.dogsbodytechnology.com/ #
# #
# Creates the correct file to push to a secondary provider #
# #
##############################################################################
# EDIT BETWEEN HERE #
############################################################
SECFILE=/etc/named/zones.secdns
OLDSECFILE=/etc/named/zones.secdns.old
NCFTPDATA=/root/.ncftp
############################################################
# AND HERE #
############################################################
mv $SECFILE $OLDSECFILE
cat /dev/null > $SECFILE
IPADDRESS=`/sbin/ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'`
for DOM in $(ls -A1 /etc/named | grep "^db\." | grep -v "\.include$\|\~$" | sed s~^db.~~ | sort -d)
do echo $DOM:$IPADDRESS
done >> $SECFILE
if ! diff $OLDSECFILE $SECFILE ; then
echo "Uploading to Secondary"
ncftpput -a -f $NCFTPDATA ./ $SECFILE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment