[systemd-devel] Unit dependencies for socket activated services

Mantas Mikulėnas grawity at gmail.com
Sun Oct 13 14:38:53 UTC 2019


On Sun, Oct 13, 2019 at 5:07 PM Marc Haber <mh+systemd-devel at zugschlus.de>
wrote:

> Hallo,
>
> when I want a normal service to be started only after the networks is
> ready, I put
>
> |[Unit]
> |After=network-online.target
> |Wants=network-online.target
>
> into the service unit.
>
> Now I have a socket activated service which I know won't properly start
> (but claim readiness) if started before the network is ready.
>
> Would I put those two lines into foo.service or foo.socket?
>

If you put them in foo.socket -- the socket won't even show up as
"listening" until network-online is reached, and early connection attempts
will immediately fail.

If you put them in foo.service -- the socket will be always listening, but
the service startup will wait until network-online is reached, and early
connection attempts will be queued until the service claims to be ready.

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20191013/29b0428f/attachment.html>


More information about the systemd-devel mailing list