9th Nov, 2013, 07:51 AM
I have been using ddclient but it doesn't work that well to update your IP address in case your ISP doesn't give you a static IP.
Now I have found this neat little script: first it checks IF your IP address has changed. Only if it has changed, it will update your subdomain at your dyn dns provider. It seems to be a very 'light' solution, no need to install a program like ddclient.
Perhaps the script could be added to XBian and an "checkbox" could be added to the XBian Config UI to enable it? By default it should be disabled. If enabled, user will have to select time (perhaps default 4 hrs) then all it should do is add a line to cronjob. The user would still need to fill in their token though...
But I still have 1 issue. The script seems very clean, but it needs interface data and I do not understand that part:
script is saved in /etc/freedns/dnsactual.sh.
When I run it:
I replaced PUBLIC-IF for eth0 but that doesn't work. I would like to get this script working for myself. I tried Googling the public-if part but nothing comes up. Advice?
Now I have found this neat little script: first it checks IF your IP address has changed. Only if it has changed, it will update your subdomain at your dyn dns provider. It seems to be a very 'light' solution, no need to install a program like ddclient.
Perhaps the script could be added to XBian and an "checkbox" could be added to the XBian Config UI to enable it? By default it should be disabled. If enabled, user will have to select time (perhaps default 4 hrs) then all it should do is add a line to cronjob. The user would still need to fill in their token though...
But I still have 1 issue. The script seems very clean, but it needs interface data and I do not understand that part:
Terminal
TOKEN="mytoken,removedforprivacyreasons"
IFACE=[PUBLIC-IF]
if test -f /etc/freedns/dnsactual.conf
then
CacheIP=$(cat /etc/freedns/dnsactual.conf)
fi
CurreIP=$(ifconfig $IFACE | grep -oEe "addr:[0-9\.]*" | cut -f 2 -d
if [ "$CurreIP" = "$CacheIP" ]
then
# Both IP are equal
echo "Update not required..."
else
# The IP has change
echo "Updating http://free.afraid.org with " $CurreIP
wget http://freedns.afraid.org/dynamic/update.php?$TOKEN -o /dev/null -O /dev/stdout
echo `date` "Updating log with IP " $CurreIP >> /var/log/dnsactual.log
fi
rm -f /etc/freedns/dnsactual.conf
echo $CurreIP > /etc/freedns/dnsactual.conf
IFACE=[PUBLIC-IF]
if test -f /etc/freedns/dnsactual.conf
then
CacheIP=$(cat /etc/freedns/dnsactual.conf)
fi
CurreIP=$(ifconfig $IFACE | grep -oEe "addr:[0-9\.]*" | cut -f 2 -d
if [ "$CurreIP" = "$CacheIP" ]
then
# Both IP are equal
echo "Update not required..."
else
# The IP has change
echo "Updating http://free.afraid.org with " $CurreIP
wget http://freedns.afraid.org/dynamic/update.php?$TOKEN -o /dev/null -O /dev/stdout
echo `date` "Updating log with IP " $CurreIP >> /var/log/dnsactual.log
fi
rm -f /etc/freedns/dnsactual.conf
echo $CurreIP > /etc/freedns/dnsactual.conf
script is saved in /etc/freedns/dnsactual.sh.
When I run it:
Terminal
xbian@xbian /etc/freedns $ sudo sh dnsactual.sh
[PUBLIC-IF]: error fetching interface information: Device not found
Update not required...
[PUBLIC-IF]: error fetching interface information: Device not found
Update not required...
I replaced PUBLIC-IF for eth0 but that doesn't work. I would like to get this script working for myself. I tried Googling the public-if part but nothing comes up. Advice?