Skip to content

Instantly share code, notes, and snippets.

@h0tw1r3

h0tw1r3/ifup-d.sh

Last active Aug 29, 2015
Embed
What would you like to do?
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