使用变量设置WorkingDirectory


15

如何使用环境变量设置Service WorkingDirectory?这是一个示例服务配置:

[Service]
Environment=MYWORKINGDIR=/tmp
WorkingDirectory=${MYWORKINGDIR}

这会沿产生错误not an absolute path。在开始处添加斜杠可“修复”该错误,但仍未找到路径:

[Service]
Environment=MYWORKINGDIR=/tmp
WorkingDirectory=/${MYWORKINGDIR}

这有可能吗?关于哪些指令可以/不能使用env变量的文档尚不清楚。

http://www.freedesktop.org/software/systemd/man/systemd.exec.html

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.