Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a dynamic DNS script as follows:

#!/bin/bash
curl -kL# "http://example.com/updatedns.php"
echo $? >> /var/log/ddns

...saved to /usr/local/bin/ddns. Obviously the URL above isn't the one I actually use, but the URL is meant to set the A record of my domain to the IP of the machine that requested it. I have confirmed it has been chmodded and runs from the command line, however, Upstart, which has been set up with the following script:

start on network started
exec /usr/local/bin/ddns

...doesn't execute it when the network starts (which I'm assuming is when the machine is booted or I connect the network cord).

I googled start on network started and found some results saying that this stanza doesn't actually get started properly, but still gets triggered, however I'm not sure if that's related or not. Am I doing something wrong? I'm running Ubuntu Server 11.10.

share|improve this question

2 Answers 2

up vote 2 down vote accepted
grep 'emit' /etc/network/if-up.d/upstart -a5

Suggests you should probably use start on net-device-up.

If you have more than one det device (and all don't have gateways), you can add an argument on the end like so:

start on net-device-up IFACE=eth0
share|improve this answer
    
Thanks for your answer. I tried this and it works, though I'm unsure if it'll fire when my external IP changes. I'll be able to work that out when it does tomorrow. –  kirb Jan 6 '12 at 16:45

The traditional (pre-upstart, and still working) method was to place scripts in /etc/network/if-up.d directory.

Note that Ubuntu has pre-packaged DynDNS updating scripts: I can see dyndns, ddclient, inadyn, ez-ipupdate, and ipcheck packaged in Ubuntu. All should work :)

share|improve this answer

Your Answer

 
discard

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.