[systemd-devel] networkd - how to start service right after the "link configured" stage?

Tom Gundersen teg at jklm.no
Tue Nov 25 05:35:00 PST 2014


On Tue, Nov 25, 2014 at 1:02 PM, Peter Lemenkov <lemenkov at gmail.com> wrote:
> I'm currently doing a great stuff with systemd-networkd but one thing
> is holding me back. One of my services is starting too early. I'd love
> to delay its startup right after the "link configured" stage.So far
> I've got the followng in journal logs:
>
> el7 ~: sudo journalctl -M mycontainer -b --unit="systemd-networkd"
> -- Logs begin at Пн 2014-11-24 16:41:18 MSK, end at Вт 2014-11-25
> 14:53:14 MSK. --
> ноя 25 14:53:08 mycontainer systemd[1]: Starting Network Service...
> ноя 25 14:53:08 mycontainer systemd[1]: Started Network Service.
> ноя 25 14:53:08 mycontainer systemd-networkd[29]: host0           :
> gained carrier
> ноя 25 14:53:08 mycontainer systemd-networkd[29]: host0           :
> DHCPv4 address 192.168.122.169/24 via 192.168.122.1
> ноя 25 14:53:14 mycontainer systemd-networkd[29]: host0           :
> link configured
> el7 ~:
>
> So far I've got few questions:
>
> - Does networkd emit some D-Bus event when the network link is configured?

networkd currently does not have an dbus API (will get once we have kdbus).

> - If yes is it possible to add a systemd service triggered by this
> D-Bus message?
> - If no is there a way to start systemd service after the given
> network link is configured?

We have an (so far internal) library sd-network, which allows you to
monitor for events. /lib/systemd/networkd-wait-online uses this, and
it may fit your needs (it has various command-line options you may
tweak to make it do what you want).

HTH,

Tom


More information about the systemd-devel mailing list