I've made some revisions to my change IP daemon script. I was having trouble with ZoneEdit getting out of sync because the script would miss an IP change, so I've updated it to check not whether the workstation thinks the IP is different, but rather check with ZoneEdit. I do call a small VBScript file, because I couldn't figure out how to parse the IP address from the ZoneEdit page using BASH scripting. I find that every problem is a nail.


$ cat bat/chipd





eEdit.







ipfile=/etc/chipd.txt

logfile=/var/log/chipd.log

actual_ip_src="http://bovwimi.net/"

defined_ip_src="http://www.zoneedit.com/auth/edit.html?zone=yousuck.net"

datefmt="%n%Y-%m-%d %T"



  #Output banner

  date +"$datefmt"

  echo "Starting $0..."



  # Get the current actual IP from a website

  date +"$datefmt"

  echo "Grabbing current IP from $actual_ip_src..."

  actual_ip=$(lynx -source $actual_ip_src | grep -i "" | awk '{print $4}'

)



  # If we get a blank IP from the web, set actual to value in ipfile,

  # where we stored the IP we pulled during the last run if chipd

  if [ "$actual_ip" == "" ];

  then

    actual_ip=$(cat $ipfile)

  fi



  # pull HTML from ZoneEdit (contains IP)

  date +"$datefmt"

  echo "Grabbing defined IP from $defined_ip_src..."

  cd ~/bat

  lynx -source -auth=luser:password "$defined_ip_src" | grep "span class="

zone">anglo-hexon.net</span></a></td><td>   " > ipcrap_temp.txt

  defined_ip=$(cscript parseip.vbs ipcrap_temp.txt)



  # If we get a blank IP from ZoneEdit, set defined to actual

  if [ "$defined_ip" == "" ];

  then

    date +"$datefmt"

    echo "Retrieved a blank defined_ip, resetting value to $actual_ip..."

    defined_ip=$actual_ip

  fi



  # Determine if the IP has changed, if so, update everything

  if [ "$actual_ip" == "$defined_ip" ];

  then

    date +"$datefmt"

    echo "IP hasn't changed (old=$defined_ip, new=$actual_ip)..."

  else

    date +"$datefmt"

    echo "New IP detected (old=$defined_ip, new=$actual_ip), updating..."

    zedit >> $logfile

    sendip

 fi



 # Store the new IP

 defined_ip="$actual_ip"

 export defined_ip

 echo $defined_ip > $ipfile

  </pre>

</p>

<br /><br />
<a name="more"></a>
</div>
</div>
<div class="content">
<div class="contenttitle">
<h2>Comments</h2>
</div>
<a name="c"></a>
<div class="comments">No comments yet</div>
</div>
<div class="content">
<div class="contenttitle">
<h2>Add Comment</h2>
</div>
<div class="commentform">You must be logged in as a member to add comment to this blog</div>

</div>
</div>

<!-- page menu -->
<h2 class="hidden">Sidebar</h2>
<div id="sidebarcontainer">
<!-- page menu -->
<div class="sidebar">
<dl class="sidebardl">
<dt>Navigation</dt>

<!-- archive: navigation -->


<!-- archivelist: navigation -->


<!-- error: navigation -->


<!-- index: navigation -->


<!-- item: navigation -->

<dd><a href="flog.php?itemid=616" title="Previous item">Previous Item</a></dd>
<dd><a href="flog.php?itemid=614" title="Next item">Next Item</a></dd>
<dd><a href="flog.php?blogid=2" title="Today's entry">Today</a></dd>
<dd><a href="flog.php?archivelist=2" title="Archives">Archives</a></dd>


<!-- member: navigation -->


<!-- search: navigation -->


<!-- admin link, only visible if logged in -->

</dl>
</div>

<!-- category list, not on error or member page -->


<div class="sidebar">
<dl class="sidebardl">
<dt>Categories</dt>
<dd>
<a href="flog.php?blogid=2" title="All categories">All</a>
</dd><dd>
<a href="flog.php?catid=9&blogid=2" title="Category: General">General</a>
</dd><dd>
<a href="flog.php?catid=12&blogid=2" title="Category: tech">tech</a>
</dd>
</dl>
</div>


<!-- bloglist-->
<div class="sidebar">
<dl class="sidebardl">
<dt>Blogs</dt>

</dl>
</div>

<!-- search form -->
<div class="sidebar">
<dl class="sidebardl">
<dt>Search</dt>
<dd><form method="get" action="flog.php">
	<div class="searchform">
<input type="hidden" name="amount" value="0" />
<input type="hidden" name="blogid" value="2" />
		<input name="query" alt="Keywords to search" class="formfield" size="10" maxlength="60" accesskey="4" value="" />
		<input type="submit" alt="Search" value="Search" class="formbutton" />
	</div>
</form>
</dd>
</dl>
</div>

<!-- login form -->
<div class="sidebar">
<dl class="sidebardl">
<dt>Login</dt>
<dd><a id="nucleus_lf"> </a>
<form method="post" action="#nucleus_lf">
	<div class="loginform">
<input type="hidden" name="action" value="login" />
		

		<label for="nucleus_lf_name" accesskey="l">Username:</label>
		<input id="nucleus_lf_name" name="login" size="10" value="" class="formfield" />

		<label for="nucleus_lf_pwd">Password:</label>
		<input id="nucleus_lf_pwd" name="password" size="10" type="password" value="" class="formfield" />

		<input type="checkbox" value="1" name="shared" id="nucleus_lf_shared" />
		<label for="nucleus_lf_shared">Shared Computer</label>

		<input type="submit" alt="Log In" value="Log In" class="formbutton" />
	</div>
</form>
</dd>
</dl>
</div>

<!-- links -->
<div class="sidebar">
<dl class="sidebardl">
<dt>Links</dt>
<dd><a href="http://nucleuscms.org" title="Nucleus CMS Home">nucleuscms.org</a></dd>
<dd><a href="http://docs.nucleuscms.org/" title="Nucleus CMS Documentation">docs.nucleuscms.org</a></dd>
<dd><a href="http://forum.nucleuscms.org" title="Nucleus CMS Support Forum">forum.nucleuscms.org</a></dd>
<dd><a href="http://wiki.nucleuscms.org/" title="Nucleus CMS Wiki">wiki.nucleuscms.org</a></dd>
<dd><a href="http://skins.nucleuscms.org/" title="Nucleus CMS Skins">skins.nucleuscms.org</a></dd>
<dd><a href="http://wiki.nucleuscms.org/plugin" title="Nucleus CMS Plugins">plugins.nucleuscms.org</a></dd>
<dd><a href="http://dev.nucleuscms.org/" title="Nucleus Developer Network">dev.nucleuscms.org</a></dd>
</dl>
</div>

<!-- Powered by -->
<div class="sidebar">
<div class="sidebardl centerize">
<div class="nucleusbutton">
	<a href="http://nucleuscms.org/"><img src="/blog/skins/default/images/nucleus.gif" width="85" height="31" alt="Powered by Nucleus CMS" title="Powered by Nucleus CMS" /></a>
</div>

</div>
</div>
</div>

<!-- page footer -->
<div class="clearing"> </div>
</div>
</div>
<!-- end wrapper divs -->

<!-- page footer, copyrights, etc. -->
<div id="footer">
<div id="copyrights">
	<small>Copyright | <a href="http://nucleuscms.org">Nucleus CMS v3.65</a> | 
	<a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.0 Strict</a> | 
	<a href="http://jigsaw.w3.org/css-validator/">Valid CSS</a> | 
	<a href="#top">Back to top</a></small>
</div>
</div>

</body>
</html>