[NBLUG/talk] Recap of systemd talk, and other thoughts?
anfrind at gmail.com
Wed Jun 17 09:59:32 PDT 2015
On Fri, Jun 12, 2015 at 11:03 AM Lincoln Peters <anfrind at gmail.com> wrote:
> In our case, the parameter is passed through to the start script as a
> command-line argument, and if, for example, I issue the following commands:
> systemctl start myserver at alethkar
> systemctl start myserver at frostlands
> systemctl start myserver at jah-keved
> The first two instances start as expected, but the third fails because
> systemd escapes the parameter to "jah\-keved"* before passing it to my
> script, no matter if I use %i (escaped instance name) or %I (unescaped
> instance name) in my .service file, which would seem to contradict what the
> documentation says. As you might expect, when my start script sees the
> "escaped" parameter, it gets confused and does the wrong thing. I may need
> to modify my start script to un-escape the parameter itself in order to
> make it work.
I figured out what's going on (and, yes, the escaped parameter in my
original post was wrong). It turns out that systemd treats slashes as a
special character and "escapes" them into dashes (and escapes dashes into a
hex representation), and it expects that any parameter passed as an
argument to systemctl has *already* been escaped. So in the aforementioned
case of "myserver at jah-keved", it un-escapes the parameter to "jah/keved",
which my service recognizes as invalid.
If I want "jah-keved" to be passed to my start script, I need to issue the
systemctl start myserver at jah\x2dkeved
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the talk