EdgeOS already supports Python (as of 1.10.9), so let’s write a short Python script. Replace with your username, password and domain on line 13 in the script.
import urllib2
import datetime
import os
print 'IP Updater - ' + datetime.datetime.now().isoformat()
f = os.popen('/sbin/ifconfig eth0 | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1')
ip=f.read()
print 'IP detected as: ' + ip
if(ip):
sendOne = urllib2.urlopen('http://dyndns.topdns.com/update?hostname=my-domain.com&username=user&password=password&myip=' + ip).read()
print sendOne
Schedule it to run recurrently:
touch /var/log/ibs-update.log
crontab -e
Add the following line:
0 * * * * python /home/ubnt/ibs-update.py >> /var/log/ibs-update.log
Note: /var/log
is mounted in-memory on EdgeOS, so it’s not going to introduce wear-and-tear on the flash memory.