[systemd-devel] Ensuring that a unit starts before any networking

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sat Jun 27 10:06:25 UTC 2020


On Sat, Jun 27, 2020 at 09:34:00AM +0100, Mark Rogers wrote:
> I have tried multiple approaches so far but by current service file
> looks like this:
> 
> [Unit]
> Description=Config generation from DB
> Before=networking.service

You should use Before=network-pre.target, Wants=network-pre.target.

> [Service]
> Type=oneshot
> ExecStart=/home/mark/bin/db2config.py
> 
> [Install]
> RequiredBy=network.target
> 
> [1] https://stackoverflow.com/questions/62574482/ensuring-that-a-systemd-unit-starts-before-any-networking
> - no responses there to date, feel free to respond there for
> reputation or else I'll update it when I solve it.

Yes, please update so. Also feel free to submit a PR for our man pages
if you find the time. netowrk-pre.target is briefly explained in
systemd.special(7), but maybe the network target deserve a separate
section in bootup(7)?

Zbyszek


More information about the systemd-devel mailing list