You are not logged in.

#1 2007-05-15 18:45:19

crouse
Arch Linux f@h Team Member
From: Iowa - USA
Registered: 2006-08-19
Posts: 907
Website

ZoneEdit.com dynamic IP correction script

I put this together today, not sure if anyone else would find it useful, but just in case......

#!/bin/bash
# zoneedit.sh - Zoneedit.com Dynamic Dns Corrections.
#Created by Crouse
#05-15-2007
#Edit the next 3 lines
website="yourwebsite.com"
zoneeditusername="YOURUSERNAME"
zoneeditpassword="YOURPASSWORD"


#Update IP address function, corrects settings on zoneedit.com
updateip ()
{
#Change entry for url with the www. prefix
wget -q -O - --http-user="${zoneeditusername}" --http-passwd="${zoneeditpassword}" "http://dynamic.zoneedit.com/auth/dynamic.html?host=www.${website}" > /dev/null 2>&1
#Change the entry for the url without the www. prefix
wget -O  - --http-user="${zoneeditusername}" --http-passwd="${zoneeditpassword}" "http://dynamic.zoneedit.com/auth/dynamic.html?host=${website}" > /dev/null 2>&1
}

#Determine the current real ip address for this machine.
actualip=`lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g'`


#Read in the current ip from currentip log file. Assign that value to a variable for comparison.
currentip=`less /home/$USER/.zoneedit`

#Output to display .... could echo it all to an email if setup as a cron job.
echo " "
echo "Zoneedit.com Update Check"
echo "The actual IP is: " $actualip
echo "The current IP is: " $currentip

if [ "$actualip" == "$currentip" ]
     then
        echo "The IP's match, nothing to do, exiting."
   echo " "
      else
         echo "IP's do not match"
         echo "Updating the zone edit file." ; updateip
         echo "Updating the .zoneedit file locally."
         echo $actualip > /home/$USER/.zoneedit
         echo "ZoneEdit update completed."
         echo " "
fi

Offline

Board footer

Powered by FluxBB