[systemd-devel] run no more than one of foo at .service at a time

Colin Guthrie gmane at colin.guthr.ie
Tue Oct 6 05:02:56 PDT 2015


Johannes Ernst wrote on 05/10/15 23:53:
> 
>> On Oct 5, 2015, at 14:29, David Timothy Strauss
>> <david at davidstrauss.net <mailto:david at davidstrauss.net>> wrote:
>>
>> If you only want one instance running, why not just create one service
>> and reconfigure/restart it?
>>
> Because the service dependencies are totally different.

If the service dependencies are totally different, why are you using a
templated unit? Surely templated units have to have the same dependences.

Basically in your unit, you are presumably using %i or %I in it in some
capacity.

What David suggested was using a
/etc/systemd/system/foo.service.d/config.conf dropin file to add a
"Environment=MYVAR=newval" line and use $MYVAR in your unit rather than
%i or %I.

This is the same approach but you configure your unit appropriately
rather than using instances.

If you post your unit or provide more details of the kind of thing you
are actually wanting to achieve (rather than the solution you want) then
people may be able to offer other suggestions.

Cheers

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list