Skip to content

Instantly share code, notes, and snippets.

@mklooss
Created January 30, 2013 14:33
Show Gist options
  • Select an option

  • Save mklooss/4673654 to your computer and use it in GitHub Desktop.

Select an option

Save mklooss/4673654 to your computer and use it in GitHub Desktop.
ez-ipupdate DynDNS Updater, without Spamming DynDNS
*/5 * * * * root /usr/local/bin/dyndns.sh > /dev/null
#!/bin/bash
IPTMP_FILE="/tmp/ipaddr.txt"
touch $IPTMP_FILE
CURRENT_IP=""
CURRENT_IP=`/usr/bin/curl -s 1 -q http://www.gunah.eu/ip.php | xargs`
OLD_IP=""
OLD_IP=`/bin/cat /tmp/ipaddr.txt | xargs`
source /etc/ez-ipupdate/GENERAL
if [ ${#CURRENT_IP} != "0" ]; then
if [ "$CURRENT_IP" != "$OLD_IP" ]; then
for conf in /etc/ez-ipupdate/*.conf; do
echo "set new ip `basename $CURRENT_IP`"
/usr/sbin/ez-ipupdate -S $DYNTYPE --user $DYNUSER -c $conf -a $CURRENT_IP
done
echo $CURRENT_IP > $IPTMP_FILE
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment