<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi guys,<br>
<br>
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.<br>
<br>
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.<br>
<br>
I just like to say that I followed this guide:
<a class="moz-txt-link-freetext" href="https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget">https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget</a>
where I quote "<i>Alternatively, you can change your service that
needs the network to be up, to include After=network-online.target
and Wants=network-online.target.</i>"<br>
<br>
Once again thanks all for the help.<br>
<br>
---<br>
BR,<br>
<br>
Swetli<br>
<br>
<div class="moz-cite-prefix">On 08/01/2016 03:38 PM, Andrei
Borzenkov wrote:<br>
</div>
<blockquote
cite="mid:CAA91j0X7J1EqGv9j==eSjvgSFMu4wAJ=HFJwmRaYeQFpTwebaA@mail.gmail.com"
type="cite">
<pre wrap="">On Mon, Aug 1, 2016 at 2:43 PM, Michael Chapman <a class="moz-txt-link-rfc2396E" href="mailto:mike@very.puzzling.org"><mike@very.puzzling.org></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Mon, 1 Aug 2016, Andrei Borzenkov wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
On Mon, Aug 1, 2016 at 2:23 PM, Michael Chapman <a class="moz-txt-link-rfc2396E" href="mailto:mike@very.puzzling.org"><mike@very.puzzling.org></a>
wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
On Mon, 1 Aug 2016, Andrei Borzenkov wrote:
[...]
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">
So here goes what I've done:
1. Create a service and put it in the network-online.target:
/etc/systemd/system/change-target.service:
[Unit]
Description=Change Target
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=/tmp/script.sh
TimeoutSec=60s
[Install]
WantedBy=network-online.target
</pre>
</blockquote>
<pre wrap="">
This unit have conflicting requirements - on one hand it is
After=network-online.target, OTOH WantedBy=network-online.target
implies Before=network-online.target.
</pre>
</blockquote>
<pre wrap="">
I've seen this asserted on this list a few times, but as far as I can
tell
it isn't actually correct. After/Before are meant to be completely
orthogonal to Wants/Requires/etc., according to the documentation.
</pre>
</blockquote>
<pre wrap="">
Unless DefaultDependencies= is set to no in either of releated units
or an explicit ordering dependency is already defined, target units
will implicitly complement all configured dependencies of type Wants=
or Requires= with dependencies of type After=.
man systemd.target
</pre>
</blockquote>
<pre wrap="">
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:
</pre>
</blockquote>
<pre wrap="">
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
<a class="moz-txt-link-abbreviated" href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>