Re: Q: Wants and WantedBy links in generated units and circular dependencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 23, 2019 at 11:56 AM Ulrich Windl
<Ulrich.Windl@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Hi!
>
> After seeing that systemd generators are run as the very first step in
> systemd's life (deduced from the timestamps), I quit the idea of using them,
> and started to use another sort of generator:
>
> I have a generator target, that creates another target and a few service
> targets.
> The interesting point is circular dependencies for the generated units, and
> I'd like to ask if the following would work:
>
> I need to enable a generated target to get ist wants-links installed; likewise
> the generated service units need to be enabled to get the wants link from the
> target to the service.
> As my generator created the service units first, then the target unit which
> "Wants" the service units.
> The idea is that starting the soingle target unit will start all depending
> service units.
>
> So far that is without enabling. I wonder whether I can enable the service
> units that are "WantedBy" the target unit _before_ the target unit was actually
> generated.

If target unit Wants your service units, there is nothing to enable.

> If that doesn't work, I'll need a two-pass approach.
>
> For history, one of the odd things in systemd v228 is this:
>  # systemctl status iotwatch.target
> ● iotwatch.target
>    Loaded: not-found (Reason: No such file or directory)
>    Active: inactive (dead)
> # systemctl enable iotwatch.target   ### thios command must do something
> magic!

It also implicitly does "systemctl daemon-reload". It should not
really be necessary in this case (systemd should attempt to load
missing definition) but with so old version who knows.

> # systemctl status iotwatch.target
> ● iotwatch.target - iotwatch I/O performance monitor
>    Loaded: loaded (/run/systemd/system/iotwatch.target; enabled; vendor
> preset: disabled)
>    Active: inactive (dead)
>      Docs: man:iotwatch@.service(8)
>            man:iotwatch-generator(8)
>
>
> So it seems I must enable units just to be able to query whether they are
> enabled...???
>

systemctl is-enabled
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux