DNS Made Easy
Jump to navigation
Jump to search
DNS Made Easy
DNS Made Easy - http://www.dnsmadeeasy.com/
Dynamic DNS
Dynamic DNS, DDNS, DDNS Hosting and API - http://www.dnsmadeeasy.com/services/dynamic-dns/
Shell Script
Shell Script - dnsmadeeasy-update.sh - http://oldwww.dnsmadeeasy.com/wp-content/uploads/2012/06/dnsmadeeasy-update.tar
#!/bin/sh
#
# dnsmadeeasy-update.sh
#
# This script updates Dynamic DNS records on DNE Made Easy's
# DNS servers. You must have wget installed for this to work.
#
# Author: Jeff Larkin <fu_fish@users.sourceforge.net>
# Last Modified: 08-February-2002
#
# This script is released as public domain in hope that it will
# be useful to others using DNS Made Easy. It is provided
# as-is with no warranty implied. Sending passwords as a part
# of an HTTP request is inherently insecure. I take no responsibilty
# if your password is discovered by use of this script.
#
# This is the e-mail address that you use to login
DMEUSER=<username>
# This is your password
DMEPASS=<password>
# This is the unique number for the record that you are updating.
# This number can be obtained by clicking on the DDNS link for the
# record that you wish to update; the number for the record is listed
# on the next page.
DMEID=<record number>
# Obtain current ip address
IPADDR=`ifconfig eth0 | grep inet | awk '{print $2}' | awk -F : '{print $2}'`
if wget -q -O /proc/self/fd/1 http://www.dnsmadeeasy.com/servlet/updateip?username=$DMEUSER\&password=$DMEPASS\&id=$DMEID\&ip=$IPADDR | grep success > /dev/null; then
logger -t DNS-Made-Easy -s "DNS Record Updated Successfully"
else
logger -t DNS-Made-Easy -s "Problem updating DNS record."
fi
# David Harris's script for dynodns.net was used as an example
# in writing this script.
My modifications
/home/kenneth/.admin/dnsmadeeasy.sh:
#!/bin/bash
#
# dnsmadeeasy-update.sh
#
# This script updates Dynamic DNS records on DNE Made Easy's
# DNS servers. You must have wget installed for this to work.
#
# Author: Jeff Larkin <fu_fish@users.sourceforge.net>
# Last Modified: 08-February-2002
#
# This script is released as public domain in hope that it will
# be useful to others using DNS Made Easy. It is provided
# as-is with no warranty implied. Sending passwords as a part
# of an HTTP request is inherently insecure. I take no responsibilty
# if your password is discovered by use of this script.
#
# This is the e-mail address that you use to login
DMEUSER=<username>
# This is your password
DMEPASS=<password>
# This is the unique number for the record that you are updating.
# This number can be obtained by clicking on the DDNS link for the
# record that you wish to update; the number for the record is listed
# on the next page.
DMEID=<record number>
# Domain name for log messages
DMEDOMAIN=<domainname>
# Temporary Save Location
#LAST=/tmp/dnsmadeeasy
LAST=/home/kenneth/.admin/.dnsmadeeasy
#echo "Updating $DMEDOMAIN..."
# Obtain current ip address
#IPADDR=`ifconfig eth0 | grep inet | awk '{print $2}' | awk -F : '{print $2}'`
IPADDR=`curl http://ip.oeey.com 2> /dev/null`
# Is Valid IP?
echo $IPADDR | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$" > /dev/null
if [ $? -ne 0 ] ; then
# try second time
sleep 3
IPADDR=`curl http://ip.oeey.com 2> /dev/null`
echo $IPADDR | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$" > /dev/null
if [ $? -ne 0 ] ; then
logger -t DNS-Made-Easy "Failed to determine public IP Address"
exit 1
fi
fi
#echo "==$IPADDR=="
# Save last ip to look for changes
if [ -e $LAST ] ; then
LASTIP=`cat $LAST`
else
LASTIP=
fi
echo $IPADDR > $LAST
if [ "$IPADDR" == "$LASTIP" ] ; then
logger -t DNS-Made-Easy "No change to DNS Record $DMEDOMAIN: $IPADDR"
exit 0
else
logger -t DNS-Made-Easy "Change to DNS Record $DMEDOMAIN: $IPADDR"
fi
if wget -q -O /proc/self/fd/1 https://cp.dnsmadeeasy.com/servlet/updateip?username=$DMEUSER\&password=$DMEPASS\&id=$DMEID\&ip=$IPADDR | grep success > /dev/null; then
logger -t DNS-Made-Easy "DNS Record $DMEDOMAIN Updated Successfully to $IPADDR"
else
# try second time
sleep 3
if wget -q -O /proc/self/fd/1 https://cp.dnsmadeeasy.com/servlet/updateip?username=$DMEUSER\&password=$DMEPASS\&id=$DMEID\&ip=$IPADDR | grep success > /dev/null; then
logger -t DNS-Made-Easy -s "DNS Record $DMEDOMAIN Updated Successfully to $IPADDR"
else
logger -t DNS-Made-Easy -s "Problem updating $DMEDOMAIN DNS record to $IPADDR."
fi
fi
# David Harris's script for dynodns.net was used as an example
# in writing this script.
with a cronjob of:
*/30 * * * * /home/kenneth/.admin/dnsmadeeasy-update.sh @reboot /home/kenneth/.admin/dnsmadeeasy-update.sh