[systemd-devel] /etc/systemd/system/darkice.service

Kai Hendry hendry at iki.fi
Mon Jul 22 02:48:11 PDT 2013

On 19 July 2013 01:29, Lennart Poettering <lennart at poettering.net> wrote:
> It is certainly surprising at first, but it makes a lot of sense. In
> systemd ordering deps and requirement deps are truly orthogonal. This is
> useful in many cases, because sometimes you just want to pull something
> else in, but not imply any ordering, sometimes you want to order without
> actually pulling it in, and often you want to do both. Of course, not
> all deps make sense in all combinations, but I think it's easy enough to
> grasp.

What happens in the range of error cases when a user puts a Wants=
line under the (wrong) [Install] heading?

I tried it and network-online.target was loaded inactive dead, so it
failed IIUC. No warning that Wants= line is in the wrong place. This
sucks quite a lot imo.

Wouldn't it be simpler if systemd ignored the headings? Anyway, it's
just a comment. I am still trying to figure darkice starting out.

> I figure you could try this with a service like the following (untested):
>     [Unit]
>     Before=network-online.target
>     [Service]
>     ExecStart=/usr/bin/ping -nq -w 60 -c 1
>     Type=oneshot
>     StandardOutput=null
>     [Install]
>     WantedBy=network-online.target
> Then, install and enable this service, and pull in network-online.target
> from the service that you want to wait for the network to be around.

I enabled the above as pingtest.service and added
Wants=network-online.target under the [Unit] heading in

Still I don't understand how pingtest.service can fail here with exit
2 and even more confusingly network-online.target is reached!?

> This will timeout after 60 seconds.

Isn't this better "controlled" by systemd itself? And not be a command
line switch in the exec?

> It's hacky, generates awful traffic, and has quite some latency, but it
> should do what you asked for...

Awful traffic? One successful ping and we continue IIUC.

A lot of routers IIUC do a heart beat type ping to ensure it's up. And
if not it would switch to another route or something. If routers are
doing this, why can't my device? Is it really that expensive??

More information about the systemd-devel mailing list