Re: [systemd-devel] How to exclusively toggle between two systemd instances of a single daemon?

2014-10-08 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Oct 08, 2014 at 06:30:51AM -0700, terrygalant.li...@fastest.cc wrote:
 Hi
 
 I have 2 installed instances of a single daemon.
 
 1 is from distro-installed packages, installed into standard default OS 
 locations with unit files in /usr/lib/systemd/system/.
 
 The other is installed under /opt, with unit files currently in 
 /opt/mydaemon/systemd/system/, which can be (un)symlinked as needed into 
 /etc/systemd/system/multi-user.target.wants/ to disable or enable.
 
 I want to be able to occasionally toggle between use of the 2.
 
 Is the right systemd way to do manage this toggle to just name the 2 
 instances' unit files differently, put a Conflicts= in each for the other, 
 and just use 'enable' for whichever I want active?

That would work.

You can also make a symlink from /etc/systemd/system/xxx.service to
either of the two files and manage it by hand, calling systemctl
daemon-reload afterwards. I think this should work.

 If other systemd units have a Requires= dependency on this daemon, how do I 
 deal with the toggle?  Is there a Require=this-instance-OR-that-instance 
 equivalent?
No.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to exclusively toggle between two systemd instances of a single daemon?

2014-10-08 Thread terrygalant . lists
Hi Zbigniew

On Wed, Oct 8, 2014, at 06:39 AM, Zbigniew Jędrzejewski-Szmek wrote:
 You can also make a symlink from /etc/systemd/system/xxx.service to
 either of the two files and manage it by hand, calling systemctl
 daemon-reload afterwards. I think this should work.
 
  If other systemd units have a Requires= dependency on this daemon, how do I 
  deal with the toggle?  Is there a Require=this-instance-OR-that-instance 
  equivalent?
 No.


I think then this is the right, or only?, way to deal with the toggle AND 
handle the Requires=.

Set the other units' dependency to the **symlink**'s name

   Requires=xxx.service

then manually change the symlink source AND daemon-reload to effect the toggle.

Did I understand correctly?

TerryG
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to exclusively toggle between two systemd instances of a single daemon?

2014-10-08 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Oct 08, 2014 at 06:45:48AM -0700, terrygalant.li...@fastest.cc wrote:
 Hi Zbigniew
 
 On Wed, Oct 8, 2014, at 06:39 AM, Zbigniew Jędrzejewski-Szmek wrote:
  You can also make a symlink from /etc/systemd/system/xxx.service to
  either of the two files and manage it by hand, calling systemctl
  daemon-reload afterwards. I think this should work.
  
   If other systemd units have a Requires= dependency on this daemon, how do 
   I deal with the toggle?  Is there a 
   Require=this-instance-OR-that-instance equivalent?
  No.
 
 
 I think then this is the right, or only?, way to deal with the toggle AND 
 handle the Requires=.
 
 Set the other units' dependency to the **symlink**'s name
The symlink is supposed to have the same name as the symlink target.

 
Requires=xxx.service
 
 then manually change the symlink source AND daemon-reload to effect the 
 toggle.
Yes.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to exclusively toggle between two systemd instances of a single daemon?

2014-10-08 Thread Mantas Mikulėnas
On Wed, Oct 8, 2014 at 4:39 PM, Zbigniew Jędrzejewski-Szmek 
zbys...@in.waw.pl wrote:

 On Wed, Oct 08, 2014 at 06:30:51AM -0700, terrygalant.li...@fastest.cc
 wrote:
  Hi
 
  I have 2 installed instances of a single daemon.
 
  1 is from distro-installed packages, installed into standard default OS
 locations with unit files in /usr/lib/systemd/system/.
 
  The other is installed under /opt, with unit files currently in
 /opt/mydaemon/systemd/system/, which can be (un)symlinked as needed into
 /etc/systemd/system/multi-user.target.wants/ to disable or enable.
 
  I want to be able to occasionally toggle between use of the 2.
 
  Is the right systemd way to do manage this toggle to just name the 2
 instances' unit files differently, put a Conflicts= in each for the other,
 and just use 'enable' for whichever I want active?

 That would work.

 You can also make a symlink from /etc/systemd/system/xxx.service to
 either of the two files and manage it by hand, calling systemctl
 daemon-reload afterwards. I think this should work.


Hmm, isn't this basically the same as adding identical [Install] Alias=
entries, and using `systemctl enable -f` to manage them?

-- 
Mantas Mikulėnas graw...@gmail.com
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to exclusively toggle between two systemd instances of a single daemon?

2014-10-08 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Oct 09, 2014 at 07:51:32AM +0300, Mantas Mikulėnas wrote:
 On Wed, Oct 8, 2014 at 4:39 PM, Zbigniew Jędrzejewski-Szmek 
 zbys...@in.waw.pl wrote:
 
  On Wed, Oct 08, 2014 at 06:30:51AM -0700, terrygalant.li...@fastest.cc
  wrote:
   Hi
  
   I have 2 installed instances of a single daemon.
  
   1 is from distro-installed packages, installed into standard default OS
  locations with unit files in /usr/lib/systemd/system/.
  
   The other is installed under /opt, with unit files currently in
  /opt/mydaemon/systemd/system/, which can be (un)symlinked as needed into
  /etc/systemd/system/multi-user.target.wants/ to disable or enable.
  
   I want to be able to occasionally toggle between use of the 2.
  
   Is the right systemd way to do manage this toggle to just name the 2
  instances' unit files differently, put a Conflicts= in each for the other,
  and just use 'enable' for whichever I want active?
 
  That would work.
 
  You can also make a symlink from /etc/systemd/system/xxx.service to
  either of the two files and manage it by hand, calling systemctl
  daemon-reload afterwards. I think this should work.
 
 
 Hmm, isn't this basically the same as adding identical [Install] Alias=
 entries, and using `systemctl enable -f` to manage them?
In some cases yes, but his unit files are outside of the normal search
paths, so I don't this would work.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel