I want to debug a script that contains Networkmanager-dispacher-variables like DEVICE_IFACE, IP4_GATEWAY. The Networkmanager-manual describes these variables but doesn't mention how to debug them.

I searched a lot but i am unable to figure out how to get the value of these variables. When i echo on the command line like echo ${DEVICE_IFACE} i get no value.


In the NetworkManager manual page you're reffering to, is stated :

The environment contains more information about the interface and the connection. The following variables are available for the use in the dispatcher scripts:

So this environment is obviously set up by dispatcher.d, and only accessible to scripts launched from there.

For example, you could put this line in a file in /etc/NetworkManager/dispatcher.d :

echo "interface $DEVICE_IFACE" > /tmp/myscript.log

Still referring to the manual page of NetworkManager, you will need to make it owned by root, executable, and not writable by group or others, for instance :

# chown root:root /etc/NetworkManager/dispatcher.d/myscript

# chmod a+x /etc/NetworkManager/dispatcher.d/myscript

# chmod go-w /etc/NetworkManager/dispatcher.d/myscript

Then, restarting NetworkManager, you should read something like "interface wlan0" in /tmp/myscript.log.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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