[opensuse] systemd service unit - instance id in ExecStart ?
I am creating a postfix service unit with support for multiple instances. I tried adding this: ExecStartPre=/etc/%i/system/config_postfix ExecStartPre=/etc/%i/system/update_chroot ExecStartPre=/etc/%i/system/update_postmaps which doesn't seem to work. I guess there's no instance id substitution in the name of the executable, only in the arguments? It isn't really clear from the man page. -- Per Jessen, Zürich (1.2°C) http://www.dns24.ch/ - free dynamic DNS, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Per Jessen wrote:
I am creating a postfix service unit with support for multiple instances.
I tried adding this:
ExecStartPre=/etc/%i/system/config_postfix ExecStartPre=/etc/%i/system/update_chroot ExecStartPre=/etc/%i/system/update_postmaps
which doesn't seem to work. I guess there's no instance id substitution in the name of the executable, only in the arguments? It isn't really clear from the man page.
Actually, it doesn't matter, those (opensuse supplied) scripts don't know about postfix instances anyway, see bug#790871. I'd still like to know if/where/when the instance id is being substituted or not? Also, when to use %i vs. %I ? I'm trying to use a postfix instance called "per-jessen" - with this, in the service unit I get: %i = per-jessen %I = per/jessen %f = /per/jessen According to the man page, %I is the unescaped value?? -- Per Jessen, Zürich (2.0°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tue, Feb 17, 2015 at 2:15 PM, Per Jessen <per@computer.org> wrote:
I'd still like to know if/where/when the instance id is being substituted or not?
I do not think there is exhaustive list. I believe most "obvious" places where you'd expect it to work do work. You are better off asking on systemd list.
Also, when to use %i vs. %I ? I'm trying to use a postfix instance called "per-jessen" - with this, in the service unit I get:
%i = per-jessen %I = per/jessen %f = /per/jessen
According to the man page, %I is the unescaped value??
Systemd replaces (escapes) "/" with "-". Difference between %I and %f matters mostly for mount units - systemd skips leading "/" so name for mount unit for /tmp is tmp.mount. %I would give you back "tmp" and %f - /tmp. In general you should use %I or %f and escape instantiated name appropriately. Not sure if 13.2 already has it, upstream now offers systemd-escape helper to do it. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Andrei Borzenkov wrote:
Also, when to use %i vs. %I ? I'm trying to use a postfix instance called "per-jessen" - with this, in the service unit I get:
%i = per-jessen %I = per/jessen %f = /per/jessen
According to the man page, %I is the unescaped value??
Systemd replaces (escapes) "/" with "-".
Ah, yes, I think I saw that mentioned somewhere. But that doesn't explain why it does the reverse too? I mean, my instance name "per-jessen" becomes "per/jessen" with %I ?
Difference between %I and %f matters mostly for mount units - systemd skips leading "/" so name for mount unit for /tmp is tmp.mount. %I would give you back "tmp" and %f - /tmp.
Ah, I see, thanks.
In general you should use %I or %f and escape instantiated name appropriately. Not sure if 13.2 already has it, upstream now offers systemd-escape helper to do it.
I don't see that helper in 13.2 yet - can you describe what you mean by "escape instantiated name appropriately" ? I did try using %I, but when it translates my hyphen to a slash, it doesn't work. thanks Per -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Tue, Feb 17, 2015 at 1:08 PM, Per Jessen <per@computer.org> wrote:
I am creating a postfix service unit with support for multiple instances.
I tried adding this:
ExecStartPre=/etc/%i/system/config_postfix ExecStartPre=/etc/%i/system/update_chroot ExecStartPre=/etc/%i/system/update_postmaps
which doesn't seem to work. I guess there's no instance id substitution in the name of the executable, only in the arguments? It isn't really clear from the man page.
Current upstream systemd.service(5) says The command line accepts "%" specifiers as described in systemd.unit(5). Note that the first argument of the command line (i.e. the program to execute) may not include specifiers. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Andrei Borzenkov wrote:
On Tue, Feb 17, 2015 at 1:08 PM, Per Jessen <per@computer.org> wrote:
I am creating a postfix service unit with support for multiple instances.
I tried adding this:
ExecStartPre=/etc/%i/system/config_postfix ExecStartPre=/etc/%i/system/update_chroot ExecStartPre=/etc/%i/system/update_postmaps
which doesn't seem to work. I guess there's no instance id substitution in the name of the executable, only in the arguments? It isn't really clear from the man page.
Current upstream systemd.service(5) says
The command line accepts "%" specifiers as described in systemd.unit(5). Note that the first argument of the command line (i.e. the program to execute) may not include specifiers.
Thanks, I had only read systemd.unit(5). /Per -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 02/17/2015 12:25 PM, Per Jessen wrote:
Andrei Borzenkov wrote:
Current upstream systemd.service(5) says
The command line accepts "%" specifiers as described in systemd.unit(5). Note that the first argument of the command line (i.e. the program to execute) may not include specifiers.
Thanks, I had only read systemd.unit(5).
Wouldn't something like the following work, then? ;-) ExecStartPre=/bin/bash /etc/%i/system/config_postfix Have a nice day, Berny -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Bernhard Voelker wrote:
On 02/17/2015 12:25 PM, Per Jessen wrote:
Andrei Borzenkov wrote:
Current upstream systemd.service(5) says
The command line accepts "%" specifiers as described in systemd.unit(5). Note that the first argument of the command line (i.e. the program to execute) may not include specifiers.
Thanks, I had only read systemd.unit(5).
Wouldn't something like the following work, then? ;-)
ExecStartPre=/bin/bash /etc/%i/system/config_postfix
Yup, that's what I did too initially, later I just commented out those -pre scripts. /Per -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 02/17/2015 05:08 AM, Per Jessen wrote:
I am creating a postfix service unit with support for multiple instances.
How is what you are doing now different from what you were doing here http://lists.opensuse.org/opensuse/2014-08/msg00333.html ... Which I found when googling for "systemd postfix multiple instances" -- A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting frowned upon? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Anton Aylward wrote:
On 02/17/2015 05:08 AM, Per Jessen wrote:
I am creating a postfix service unit with support for multiple instances.
How is what you are doing now different from what you were doing here http://lists.opensuse.org/opensuse/2014-08/msg00333.html
... Which I found when googling for "systemd postfix multiple instances"
Haha, good find! I was obviously working on the same back then :-) I guess I have just reinvented the wheel - oh well. IIRC I ran into a network issue and had to give up. Look up my post about rp_filter. That got solved, which is why I'm back on this tpoic again. -- Per Jessen, Zürich (2.6°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (4)
-
Andrei Borzenkov
-
Anton Aylward
-
Bernhard Voelker
-
Per Jessen