Re: dispatcher functionality [Version 1.0.6-1.2 on openSUSE 42.1]



On Tue, 2016-01-05 at 17:54 +0100, mick rat tin it wrote:

Hi,





First of all: on my distro there 
are no directories such as /etc/NetworkManager/dispatcher.d/pre-up.d 
and /etc/NetworkManager/dispatcher.d/pre-down.d.

Just create them. Possibly make sure that all dispatcher related files
are owned by root.




There are also some 
other issues. As a reproducible test, let's consider the following 
script (to be chmod 755 and put inside
/etc/NetworkManager/dispatcher.
d):
---




This signifies that only during "up" the script is executed: all
other 
events (down, pre-down, and pre-up) do not trigger the custom script.

During stop, NetworkManager leaves the interfaces up (except Wi-Fi,
VPN, etc, where NM needs to babysit a daemon) so that you can restart
NM without breaking network connectivity.

Therefore, no down.



If I put the system to sleep (systemctl suspend) and then resume,
both 
[down] and [up] events are triggered (but also in this case, no "pre-
" 
events).

pre-events are only invoked for scripts inside
the /etc/NetworkManager/dispatcher.d/pre-down.d.




Moreover, if I manually create the 
/etc/NetworkManager/dispatcher.d/pre-down.d directory and put the 
script  into it, as indicated in the man page, no action is
triggered 
on 
stop/start of the network.

You mean, the pre-x dispatcher scripts are not invoked?

Try enabling debug logging in /etc/NetworkManager/NetworkManager.conf

[logging]
level=DEBUG

and restart.

Also look at the logging from NetworkManager-dispatcher service
(because that's the service that invokes the scripts).




I need to launch a script before the 
network is shut-down (for instance when suspending the system via 
systemctl suspend).
I think that the pre-down may be the state to 
consider: how can I do that?

Yes, should work, with limitations.

- pre-down cannot really delay disconnecting when something external
happens. E.g. when you remove the kernel-module, the device is gone
entirely, and no pre-down script will help you.
- pre-down will not work during shutdown (because in that case NM is
also just stopped and leaves the interface up). On shutdown, have
another systemd service that tears downs whatever you want to do.


Thomas

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]