simplified systemd-networkd reload in naxalnet.service

This commit is contained in:
Pranav Jerry 2021-08-16 21:29:27 +05:30
parent d18160c46c
commit e99b3222e1
No known key found for this signature in database
GPG Key ID: F1DCDC4FED0A0C5B

View File

@ -10,6 +10,7 @@ After=iwd.service
# Stops NetworkManager and wpa_supplicant if already running
Conflicts=NetworkManager.service
Conflicts=wpa_supplicant.service
# This stops networkmanager and wpa_supplicant when naxalnet is enabled
After=NetworkManager.service
After=wpa_supplicant.service
@ -21,17 +22,21 @@ RestartSec=2sec
# IWD takes some time to find devices.
# If naxalnet is run before iwd finds devices,
# naxalnet cannot start a mesh network but exits without errors.
# TODO: Remove this line when naxalnet becomes a daemon.
# So, we give a 2s delay.
ExecStartPre=/usr/bin/sleep 2
ExecStart=/usr/bin/naxalnet
# Reload systemd-networkd after naxalnet exits
ExecStartPost=/usr/bin/systemctl reload-or-restart systemd-networkd.service
ExecStartPost=/usr/bin/networkctl reload
# Delete the interfaces created
ExecStopPost=/usr/bin/networkctl delete bridge0 bat0
# Make python flush messages the moment print() is called.
# Without this env variable, python stores output in a
# buffer before flushing to stdout. But this is not needed
# when naxalnet runs as a systemd service.
# Make python flush messages instead of buffering.
# When reading the systemd journal, we need to see the messages
# in the exact order. There will suddenly be a lot of messages
# from naxalnet, networkd, iwd and resolved. When buffering is on,
# we won't see the messages from naxalnet in the order they were
# printed. This, among other problems, make it hard while debugging.
# This will no longer be needed when naxalnet sends its messages
# directly to the systtemd journal instead of stdout.
Environment=PYTHONUNBUFFERED=1
[Install]