I came across Ninite, a utility to keep your Windows PC updated. It is a good practice to run it every once in a while.
I came across Ninite, a utility to keep your Windows PC updated. It is a good practice to run it every once in a while.
One of the requirements for having a domain name (typically) is to have a static IP, one that does not change frequently. Ordinary people face a problem, most (if not all) residential Internet services have dynamic IP addresses which change once a day (like what I have).
Companies like dyndns.com, changeip.com, no-ip.com, to name a few, have a service that you can use to have a domain name, either dedicated or shared, which can accept this kind of frequent change. All what is needed is either a router that support DDNS, or an application that is installed on a PC.
Most, if not all, DDNS companies use APIs for their service, thus this article is about API and scripting.
Steps:
cd /etc
mkdir cron.2min
chmod 755 cron.2min
0-59/2 * * * * root run-parts /etc/cron.2min
instructing the crontab to run anything in /etc/cron.2min every 2 minutes continuously everyday.
touch /root/externalip.txt
echo "2" > /root/externalip.txt
chmod 644 /root/externalip.txt
This file will be used to store the discovered external IP address by the next script below.
a=`cat /root/externalip.txt`
b=`wget -q -O - http://ip.changeip.com:8245 | cut -f 2 -d "=" | cut -f 1 -d "-" -s | grep -m 1 ^`
if [ $a != $b ]
then
# dyndns
wget --delete-after https://user:pass@members.dyndns.org/nic/update?hostname=yourhost >/dev/null 2>&1
# no-ip
wget --delete-after https://user:pass@dynupdate.no-ip.com/nic/update?hostname=yourhost >/dev/null 2>&1
# changeip
wget --delete-after https://nic.changeip.com/nic/update?hostname=*1&u=user&p=pass >/dev/null 2>&1
# opendns
wget --delete-after https://user:pass@updates.opendns.com/nic/update >/dev/null 2>&1
# update externalip.txt file
echo $b > /root/externalip.txt
fi
chmod 755 /etc/cron.2min/dynip.sh
To make it executable.
The script does the following: