Not sure if there are any systemd experts here, but I'll ask on the off-chance; I've already posted on Stack Overflow [1] if anyone knows the answer and wants credit for answering it there.
How do I ensure a systemd unit runs to completion before any network tasks start? It sounds like a simple task but I've been banging my head on this for ages and every time I think it's working it turns out I was just lucky with timing.
I have some code which generates dhcpcd.conf and wpa_supplicant.conf from settings in a database so obviously that needs to happen before any of those network tools start. But whatever magic I try in my unit configuration seems to have no impact on the start order of the unit.
My current attempt is:
[Unit] Description=Config generation from DB Before=networking.service
[Service] Type=oneshot ExecStart=/home/mark/bin/db2config.py
[Install] RequiredBy=network.target
Any ideas?
[1] https://stackoverflow.com/questions/62574482/ensuring-that-a-systemd-unit-st...