Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I wonder if system will call my script located in /etc/network/if-up.d/ or /etc/network/if-down.d/ with start or stop. The reason I am asking is that I have a script which can be called with start/stop command line arguments. In order to use with if-up.d I have to split the script into 2 parts. Is there a better way to place the script into /etc/network/if-up.d/ without splitting?

share|improve this question
up vote 1 down vote accepted

You could put the real script in one directory, and a symlink to it in the other. Then you could check $0 each time the script gets called, to see which version was invoked. This way you would retain the conveniance to edit the script in one place.

$0 is the variable, which contains the entire path to the script itself when it gets called. You would find a "if-up" or "if-down" as part of the path, and this could be interpreted as start and stop.

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.