[mythtv-users] local-network-pingable.service

Stephen Worthington stephen_agent at jsw.gen.nz
Mon Dec 6 15:04:39 UTC 2021


On Mon, 6 Dec 2021 07:06:18 -0500 (EST), you wrote:

>>>> [Service]
>>>> Type=simple
>>>> ExecStartPre=/bin/bash -c "/usr/local/bin/wait-until-pingable.py
>>>> 192.168.0.180 60"
>>>> ExecStart=/bin/true
>
>My guess is that it's because you're waiting on the results of wait-until-pingable.py.  Meaning it'll block the process until there is a response.  Once there is a response, the ExecStart will return true to SystemD so it knows it was a success.
>
>Doug

Mostly correct.  With Type=simple, once systemd has started the
ExecStart= program, it assumes that the unit is up and running and
anything depending on it can now be started.  It does not wait for the
ExecStart program to complete or to signal that it us up and running,
let alone wait for it to finish.  So the fact that /bin/true always
returns a 0 = "succeeded" result is irrelevant.

Before systemd runs ExecStart, it first runs any ExecStartPre= lines,
and waits for them to finish and return a zero result.  Each
ExecStartPre line is run in order.  If any of them returns a non-zero
result, no more ExecStartPre lines will be run, ExecStart will not be
run, and the unit will be marked as failed.  If you put a - directly
after the = of an ExecStartPre line, systemd will wait for the command
to complete, but will ignore the return code.

https://www.freedesktop.org/software/systemd/man/systemd.service.html


More information about the mythtv-users mailing list