Systemd/networkd/dispatcher: Difference between revisions
imported>Onny Created page with "[https://gitlab.com/craftyguy/networkd-dispatcher Networkd-dispatcher] is a dispatcher service for systemd-networkd connection status changes. This daemon is similar to Networ..." |
imported>Onny mNo edit summary |
||
Line 29: | Line 29: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Please refer [https:// | Please refer [https://gitlab.com/craftyguy/networkd-dispatcher upstream documentation] for configuration syntax and additional examples. | ||
[[Category:Networking]] | [[Category:Networking]] |
Revision as of 13:45, 19 February 2023
Networkd-dispatcher is a dispatcher service for systemd-networkd connection status changes. This daemon is similar to NetworkManager-dispatcher, but is much more limited in the types of events it supports due to the limited nature of systemd-networkd.
Installation
Add following line to your system configuration to install and enable Networkd-dispatcher
services.networkd-dispatcher.enable = true;
Configuration
In the following example we're going to create a script which will restart the Tor daemon everytime the interface wlan0
establishes a new successfull connection to a wifi network.
/var/lib/networkd-dispatcher/routable.d/00-restart-tor.sh
#!/usr/bin/env bash
if [[ $IFACE == "wlan0" && $AdministrativeState == "configured" ]]; then
systemctl restart tor
fi
exit 0
Adjusting file permissions for the script to work
chmod 755 /var/lib/networkd-dispatcher/routable.d/00-restart-tor
chown root /var/lib/networkd-dispatcher/routable.d/00-restart-tor
Please refer upstream documentation for configuration syntax and additional examples.