4 ms·
Why would you run the Exec command through systemd-escape? The help text says that's for the NAME of the unit... Am I missing something? Also, I'm failing to t
by colemickens 10y ago
Why would you run the Exec command through systemd-escape? The help text says that's for the NAME of the unit... Am I missing something?
Also, I'm failing to think of a scripting purpose that requires you to place non-trivial bash directly in a systemd unit that couldn't be solved by writing out the script somewhere and just invoking the script in the unit.
- chungy 10y ago> Am I missing something? You're not. Contrived example is contrived.
- naftulikay 10y ago> Now agreed, if your workflow demands that you embed a Bash while loop in a unit, you’re already in a bad place, but there are times where this is required for templating purposes. It's right there in the post. I have indeed had to do something like this in the wild to run a Docker container with special needs.
- admsyn 10y agoBoth you and OP haven't mentioned why you needed to do it inline as opposed to in an external script, though.
- colemickens 10y agoI don't see how "templating purposes" answers the question. I deploy services on VMs that need to parameterized and I can parameterize via templating a written-to-disk shell script that is then just simply executed in the unit... or I can have more dynamic parameterization and use environment variables and Environment= lines in the unit. The latter solution means the substitution is effectively happening in the same place as if they were inlined parameters, so I can't imagine a scenario when it wouldn't be workable.