[systemd-devel] Variable expansion in ConditionPathExists

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Dec 25 06:36:15 PST 2014

On Wed, Dec 24, 2014 at 10:37:50AM -0200, Marcos Felipe Rasia de Mello wrote:
> Hi,
> I have a system service that runs with a normal user account
> ([Service] User=bla). I tried
> [Unit]
> ConditionPathExists=$HOME/config.xml
> but it does not work:
> systemd[1]: [/etc/systemd/system/bla.service:4] Path in condition not
> absolute, ignoring: $HOME/config.xml
> %h also does not work (expand to /root). I am running
> systemd-216-12.fc21.x86_64.
> It is not crucial to my service, still can be useful perhaps?
unfortunately %h is not really supported anymore. Man page should be
updated, since it's rather misleading at the moment. It was removed
in systemd 209:

  * %h, %s, %U specifier support is not available anymore when
    used in unit files for PID 1. This is because NSS calls are
    not safe from PID 1. They stay available for --user
    instances of systemd, and as special case for the root user.


More information about the systemd-devel mailing list