Super User is a question and answer site for computer enthusiasts and power users. 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 have a few mount commands that I want to run on connecting to a specific network. So far I've tried using NetworkManager's dispatch functionality, inspecting the UUID:


if [ "${CONNECTION_UUID}" == "${uuid}" ]; then

That fails since the UUID of a connection seems to change on reboot. (I've verified that the script works if I modify the UUID to match the current one, then bring down the network, then bring it up again).

Is NetworkManager even the correct tool to use for this?

share|improve this question
up vote 1 down vote accepted

This question suggests exactly what you are doing, so it's interesting that the UUID seems to change on reboot.

However, one of the comments mentions another method. Put a script in /etc/network/if-up.d, and it should run every time you connect to a network. You can put in something like iwconfig | grep -q "some SSID" to test whether you are connected to a specific network (maybe you could use MAC address as well).

share|improve this answer
Yeah that is interesting, I think I'll have to dig deeper into this. The one obvious thing that differs is that the network I'm connecting to is wired. I don't know if that is what causes the UUID to change each time. – Magnus Apr 27 '14 at 7:37
One of the comments (…) hints at the answer: in order to not have the UUID change on each reboot I had to configure the wired connection rather than rely on the transient, automatically created config. – Magnus Apr 28 '14 at 7:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .