[systemd-devel] %i/%I instance expansion in ExecStartPre ?

Colin Guthrie gmane at colin.guthr.ie
Thu May 2 02:41:04 PDT 2013


'Twas brillig, and darx at sent.com at 01/05/13 16:56 did gyre and gimble:
> hi zbigniew
> 
> On Wed, May 1, 2013, at 08:32 AM, Zbigniew Jędrzejewski-Szmek wrote:
>> On Wed, May 01, 2013 at 08:29:57AM -0700, darx at sent.com wrote:
>>> Is %i/%I expansion in ExecStartPre possible? and/or have I misconfigured
>>> something here?
>> It's expressly forbidden to use specifiers in the binary name.
> 
> ok.
> 
> so, is there some other, clever way to use instances AND reference an
> instance-specific ExecStartPre=... ?
> 
> i'm thinking maybe passing an instance expansion variable to a
> statically-named script? something like
> 
> ExecStartPre=/etc/openvpn/up.general.script %I
> 
> ?  Is *THAT* allowed (I'm looking in docs for the details of these
> prohibitions ...)

The rules for ExecStartPre and ExecStart are the same so you can use the
%i/%I specifiers in the arguments - that's what they were designed for :)

Looking at "man systemd.service" and checking the ExecStart section it
says: "The command line accepts % specifiers as described in
systemd.unit(5)."

Looking at that it says:
"To refer to the instance string from within the configuration file you
may use the special %i specifier in many of the configuration options.
Other specifiers exist, the full list is:"

So granted, this isn't clear.

There are other comments that state the binary name must be a full
absolute path, but some cross reference here wouldn't be a bad idea.

Note I'm also just checking my patched up 195, not current head so this
may have been addressed already.

Documentation patches always welcome :)

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