diff --git a/naxalnet.service b/naxalnet.service index 411374e..4369822 100644 --- a/naxalnet.service +++ b/naxalnet.service @@ -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]