[systemd-devel] Option substitution in unit configuration files?
Mantas Mikulėnas
grawity at gmail.com
Sun Aug 16 07:40:33 PDT 2015
On Sun, Aug 16, 2015 at 5:36 PM, Malte Forkel <malte.forkel at berlin.de>
wrote:
> Hi,
>
> Is there some kind of option substitution in unit configuration files?
>
> In a service configuration file, I specify the PID file and would like
> to re-use its name, e.g.
> PIDFile=/var/run/myservice.pid
> ExecStartPre=/usr/bin/touch %PIDFile ; /bin/chown myuser %PIDFile
>
Generally there isn't, at least not for referencing unit options.
But for unprivileged access to pidfiles the usual approach is to create a
dedicated subdirectory under /run¹, either using RuntimeDirectory= or a
full tmpfiles.d config, and tell the service to use
"/run/myservice/myservice.pid". It might be simpler than touch+chown, and a
bit cleaner.
--
Mantas Mikulėnas <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150816/741d5f76/attachment.html>
More information about the systemd-devel
mailing list