Skip to content

Instantly share code, notes, and snippets.

@h0tw1r3
Last active August 29, 2015 14:00
Show Gist options
  • Save h0tw1r3/11405624 to your computer and use it in GitHub Desktop.
Save h0tw1r3/11405624 to your computer and use it in GitHub Desktop.
enom dynamic dns scripts for various net config systems
#!/bin/bash
#
# You must set a domain access password in the eNom control panel.
#
ENOMURL="http://dynamic.name-services.com"
if [ "$METHOD" = loopback ]; then
exit 0
fi
ERR_LOGGER="logger -s -p daemon.err -t `basename $0` -i"
mainloop () {
curl -s -I ${ENOMURL} 2>&1 >/dev/null
if [ $? -gt 0 ]; then
sleep 5
mainloop
else
updatedns
fi
}
updatedns () {
hostname=$(/bin/hostname -s)
password='******'
zone='domain.dom'
url="${ENOMURL}/interface.asp?Command=SetDNSHost:
url="${url}&HostName=${hostname}"
url="${url}&DomainPassword=${password}"
url="${url}&Zone=${zone}"
ERRCNT=$(curl -s ${url} 2>&1 | grep -- ^ErrCount=0)
if [ $? == 0 ]; then
echo "successfully updated dns record." | $ERR_LOGGER
else
echo "failed to update dns record." | $ERR_LOGGER
fi
}
mainloop &
#!/bin/bash
#
# You must set a domain access password in the eNom control panel.
#
ENOMURL="http://dynamic.name-services.com"
ERR_LOGGER="logger -s -p daemon.err -t `basename $0` -i"
mainloop () {
curl -s -I ${ENOMURL} 2>&1 >/dev/null
if [ $? -gt 0 ]; then
sleep 5
mainloop
else
updatedns
fi
}
updatedns () {
hostname=$(/bin/hostname -s)
password='*****'
zone='domain.dom'
url="${ENOMURL}/interface.asp?Command=SetDNSHost"
url="${url}&HostName=${hostname}"
url="${url}&DomainPassword=${password}"
url="${url}&Zone=${zone}"
ERRCNT=$(curl -s ${url} 2>&1 | grep -- ^ErrCount=0)
if [ $? == 0 ]; then
echo "successfully updated dns record." | $ERR_LOGGER
else
echo "failed to update dns record." | $ERR_LOGGER
fi
}
if [ "$profile" = "eth0" ]
then
mainloop &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment