Created
October 24, 2014 21:44
-
-
Save agarzon/4b28e3a57a55c39d0cc1 to your computer and use it in GitHub Desktop.
Automatically set up the Plesk DNS to work with Google Apps in a domain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "Please provide a domain name as argument" | |
exit 1 | |
fi | |
DOMAIN=$1 | |
IP=`dig +short A $DOMAIN` | |
/usr/local/psa/bin/dns -d ${DOMAIN} -a 'mail' -ip ${IP} | |
/usr/local/psa/bin/dns -d ${DOMAIN} -a 'webmail' -ip ${IP} | |
/usr/local/psa/bin/dns -d ${DOMAIN} -mx '' -mailexchanger mail.$1 | |
/usr/local/psa/bin/dns -a ${DOMAIN} -cname 'mail' -canonical ghs.googlehosted.com. | |
/usr/local/psa/bin/dns -a ${DOMAIN} -cname 'webmail' -canonical ghs.googlehosted.com. | |
/usr/local/psa/bin/dns -a ${DOMAIN} -mx '' -mailexchanger ASPMX.L.GOOGLE.COM -priority 0 | |
/usr/local/psa/bin/dns -a ${DOMAIN} -mx '' -mailexchanger ALT1.ASPMX.L.GOOGLE.COM. -priority 5 | |
/usr/local/psa/bin/dns -a ${DOMAIN} -mx '' -mailexchanger ALT2.ASPMX.L.GOOGLE.COM. -priority 5 | |
/usr/local/psa/bin/dns -a ${DOMAIN} -mx '' -mailexchanger ALT3.ASPMX.L.GOOGLE.COM. -priority 10 | |
/usr/local/psa/bin/dns -a ${DOMAIN} -mx '' -mailexchanger ALT4.ASPMX.L.GOOGLE.COM. -priority 10 | |
/usr/local/psa/bin/dns -d ${DOMAIN} -txt 'v=spf1 +a +mx -all' | |
/usr/local/psa/bin/dns -a ${DOMAIN} -txt 'v=spf1 include:_spf.google.com ~all' | |
/usr/local/psa/bin/dns --off ${DOMAIN} | |
/usr/local/psa/bin/dns --on ${DOMAIN} | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment