On Thu, 18 Mar 2010 21:52 -0400, "Brad Tilley" <b...@16systems.com>
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:
> 
> #!/bin/ksh
> 
> # Cron this script to run every X minutes. Written for OpenBSD.
> 
> # 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
>   #echo "The IP has changed"
>   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
>   curl --insecure
>   
> "https://user:p...@members.dyndns.org/nic/update?hostname=host.xxx&myip=$ip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG";
> fi
> 
> # Whether a change has occurred or not, overwrite old with new
> cp ip_new.txt ip_old.txt


I was under the impression that curl was in base. My mistake. It must
have pulled in as a dependency somewhere as I don't recall explicitly
installing it. I understand that lynx can be used to replace curl.

Brad

Reply via email to