|
Salt Lake City Wednesday, 2013.06.19 04:10 MDT [GMT-7] |
![]() |
Condition: Mostly Clear Temperature: 25°C/77.7°F Barometer: 1008.1 mb and falling |
| IT | |
|---|---|
| MIX | |
| News |
# 20100405 - adapted from a script found online - $briosky$
# cron this script to update your servers dynamic ip @dyndns.org
#
# many variants are possible. Like using macro and passing them:
# user = user_name
# pass = your_pass
# host = hostname
#
lynx -dump http://checkip.dyndns.org:8245/ | awk '{print $4}' | \
sed '/^$/d' > ip_dyndns-new.txt
ip=$(cat ip_dyndns-new.txt)
# here also there is alot to play around
# date >> ip_dyndns-date.txt
#
# cat ip_dyndns-old.txt >> ip_dyndns-history.txt
curl --insecure "https://user:pass@members.dyndns.org/nic/update? \
hostname=<host>&myip=$ip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
# variant: at the end of the previous line you can add
# curl bla-bla-bla 2>>ip_dyndns-response.txt
#
cp ip_dyndns-new.txt ip_dyndns-old.txt
#
lynx -dump http://checkip.dyndns.org:8245/ | awk '{print $4}' | \
sed '/^$/d' > ip_noip-new.txt
#
ip=$(cat ip_noip-new.txt)
#
#date >> ip_noip-date.txt
#
#cat ip_noip-old.txt >> ip_noip-history.txt
#
curl --insecure "https://<id>:<pass>@dynupdate.no-ip.com/nic/update?hostname= \
<hostname>&myip=$ip"
#
cp ip_noip-new.txt ip_noip-old.txt
# 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:pass@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
Vince Maggio, a.k.a. briosky
Last Updated on: Wednesday May 05, 2010 - 10:26:10 AM MDT