Skip to content

Instantly share code, notes, and snippets.

@jjungnickel
Created April 20, 2010 10:39
Show Gist options
  • Save jjungnickel/372290 to your computer and use it in GitHub Desktop.
Save jjungnickel/372290 to your computer and use it in GitHub Desktop.
#/bin/bash
DOMAIN=$1
TEMPFILE=`mktemp -t xfer-domain.XXXXXXXXXX`
function usage {
echo "Usage: $0 <domain>";
exit 1;
}
function transfer_domain {
dig @ns1.displayboy.com $1 +noall +answ AXFR|head -n-1 > $2
}
function load_domain {
zone2sql --gpgsql --transactions --zone=$1 | psql -hlocalhost -Upowerdns
}
function cleanup {
rm $TEMPFILE
}
if [ -z $DOMAIN ]; then
usage;
fi
transfer_domain $DOMAIN $TEMPFILE
load_domain $TEMPFILE
cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment