Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just set up ubuntu server, which has a dynamic ip. I am looking for a way to keep my dns server updated. Im using entrydns to do this and they provide the following command to update the server.

curl -k -X PUT -d "" https://entrydns.net/records/modify/TOKEN

What I need is a way of checking whether the ip has changed so I can update the dns server.

share|improve this question
Have you alread read: Ubuntu Community Help Wiki: Dynamic DNS? – Pedro Romano Nov 5 '12 at 11:38

It would be better to make a script that gets triggered any time the network configuration changes, and have that script unconditionally update DNS. If you're using Network Manager, such a script can go in /etc/NetworkManager/dispatcher.d -- see networkmanager(8) for details.

If you're not using network-manager, /etc/dhcp/dhclient-enter-hooks.d might be more appropriate.

Then you won't have to poll anything.

share|improve this answer
+1 for avoiding polling. Thanks! – Oliver Moran May 7 '13 at 7:58

Something like this would do:


# "${0%.sh}.myip" transforms /path/to/script.sh to /path/to/script.myip
if [[ ! -s "${0%.sh}.myip" ]]; then echo "" > "${0%.sh}.myip"

newip=$(curl -k -X PUT -d "" https://entrydns.net/records/modify/TOKEN)

read oldip < "${0%.sh}.myip"
echo $newip > "${0%.sh}.myip"

if [[ $newip != $oldip]]; echo "IP changed"; fi
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.