[systemd-devel] Question about changing systemd target during boot
Kai Krakow
hurikhan77 at gmail.com
Mon Aug 1 20:54:31 UTC 2016
Am Mon, 1 Aug 2016 16:09:36 +0300
schrieb Svetoslav Iliev <swetli at telco.com>:
> Hi guys,
>
> Thank you for the prompt reply and your valuable input. Just to let
> you know - I was able to do exactly what I intended. As it turns out
> my mistake was indeed creating contradiction between the WantedBy and
> After sections. Once I introduced a new "change.target" and adjusted
> my services accordingly I was able to isolate successfully either A
> or B targets during boot.
>
> I also had to split the services in two: one main blocking of type
> oneshot and one non-blocking of simple type just to switch the
> target. As it seems I cannot call systemctl isolate from onehost type
> of service.
Wouldn't it be easier to simply make your change.target the default
boot target, depending on network-online.target and a service to start
the target you need instead of isolate? Otherwise multi-user.target
starts services you are going to stop just a blink later by using
isolate.
> I just like to say that I followed this guide:
> https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget where
> I quote "/Alternatively, you can change your service that needs the
> network to be up, to include After=network-online.target and
> Wants=network-online.target./"
>
> Once again thanks all for the help.
>
> ---
> BR,
>
> Swetli
>
> On 08/01/2016 03:38 PM, Andrei Borzenkov wrote:
> > On Mon, Aug 1, 2016 at 2:43 PM, Michael Chapman
> > <mike at very.puzzling.org> wrote:
> >> On Mon, 1 Aug 2016, Andrei Borzenkov wrote:
> [...]
> [...]
> [...]
> [...]
> [...]
> [...]
> >>
> >> I just checked the code, and it looks like systemd explicitly
> >> *skips* these default dependencies if they would create a loop. In
> >> target_add_default_dependencies:
> >>
> > Yes, of course. It is also described in manual. But the question is
> > what user actually intended? It is more topic of good design.
> > _______________________________________________
> > systemd-devel mailing list
> > systemd-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
--
Regards,
Kai
Replies to list-only preferred.
More information about the systemd-devel
mailing list