ZoneEdit dynamic IP updater
This is just a bash script created around a one line lynx command I got from the ZoneEdit site on dynamic IP’s. I prettied it up so it would be easier to modify and introduced a small bit of logging. Lynx _MUST_ be installed and in the root path for this to work. Enjoy.
#!/bin/bash # Update ZoneEdit with the current IP # Lynx MUST be installed for this to work! # All that needs to happen is to hit the following URL # The ZoneEdit script (dynamic.html) collects # the requesting IP and updates the provided zone # Your ZoneEdit Username USER="Username"; # Your ZoneEdit Password PASS="Password"; # The path to where you want the log stored LOG="/Path/To/LogFile"; # The Domain name you want updated with your dynamic IP ZONE=( 'domain1.com' 'domain2.net' 'domain3.org' ) echo "---- `date +%Y-%m-%d\ %H:%M:%S` ----" >> $LOG; for DOMAIN in ${ZONE[@]} do lynx \ -source \ -auth=$USER:$PASS \ "https://dynamic.zoneedit.com/auth/dynamic.html?host=${DOMAIN}" >> $LOG sleep 5 done echo "" >> $LOG; #### Revisions #### # JWR-20080220: #Initial revision # JWR-20081122: #Domain var is now an array, #we loop through the domains updating each in kind #sleeping for 5 seconds so not to bog things down
TODO:
- Add a check for lynx, fall back to wget if its not found
- Use the comma separated URL rather than the loop for multiple domains
- Generate an email based on response code (http://www.zoneedit.com/doc/dynamic/ReturnCodes.txt)



#1 by Art on November 22nd, 2008 - 12:40 pm
Will this update multiple domains at a time?
#2 by jeffro on November 22nd, 2008 - 2:16 pm
No, unfortunately not. You will need to submit multiple ‘lynx’ commands for each domain.
I have been thinking about updating this script to manage multiple domains. Basically you just need to create an array of names, then just loop through them swapping out the $ZONE variable.
#3 by jeffro on November 22nd, 2008 - 3:00 pm
There you go, now just enter multiple domains in the ZONE array and it will update each one to the same IP. Let me know if this works for you.