On Fri, 19 Mar 2010 00:20 -0700, "Aaron Stellman" <z...@x96.org> wrote: > On Thu, Mar 18, 2010 at 09:52:28PM -0400, Brad Tilley wrote: > > There are ports that do this with more features, but I thought others > > might like to do it in base with no added software. I've been using this > > script since 4.2 and it works OK: > > since when is net/curl in base?
It's not. My mistake. Thanks to some suggestions off-list on using lynx rather than curl, this seems to work OK: #!/bin/ksh # Cron this script to run every X minutes. Written for OpenBSD base. # set FORCE_SSL_PROMPT:yes in /etc/lynx.cfg user=test pass=test host=test.dyndns.org # Get Current IP lynx -dump http://checkip.dyndns.org:8245/ | awk '{print $4}' | sed '/^$/d' > ip_new.txt # Compare new with old. diff ip_new.txt ip_old.txt # If different, send update. if [ $? -ne 0 ] then ip=$(cat ip_new.txt) # Following two lines are optional. Log date of change and IP history. date >> ip_date.txt cat ip_old.txt >> ip_history.txt lynx -dump -auth=${user}:${pass} "https://members.dyndns.org/nic/update?hostname=${host}&myip=${ip}" fi # Whether a change has occurred or not, overwrite old with new cp -f ip_new.txt ip_old.txt