Register
It is currently Wed Sep 17, 2014 9:39 pm

Crouse's ZoneEdit update Script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Tue May 15, 2007 9:07 am   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 667
Location: Des Moines, Iowa
updates your zoneedit.com file if you have a dynamic ip from your isp, and use zoneedit.com for your dns
It's a work in progress......but it does work.

Code:
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



#!/bin/bash
# zddc.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




Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP