Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Is there a way in upstart to code an event to start when network connectivity to a specific machine becomes available? Something based on a ping result would work in my case. The task being started will crash if networking dies, so respawn can start it easily enough, but if the network connection isn't available when it starts it will hang and upstart won't catch it (it's an ffmpeg instance streaming from the local ffserver to another ffserver if that helps highlight the use case).

share|improve this question

If you know the IP address of the machine you can confirm it's the 'right' machine by confirming the MAC address with something like:

arp -an

You will likely need to ping it first so that arp can find it.

Here's a script I'm using that does the same thing:



if ping -c 1 -t 1 ${ip} > /dev/null && arp -an ${ip} | grep ${mac}; then
    echo "${ip} has the expected mac addy." 

    # Mount my nfs share (requires sudo, but whatever)
    mount -t nfs -o proto=tcp,port=2049 ${ip}:/ /mnt 
    echo "This isn't the network I'm looking for."   
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.