Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 1
    I ended up doing something like that. :) Commented Nov 18, 2016 at 8:10
  • 10
    Call a bash -c to start a program from the unit file? Call exec? This is like using a forklift on top of a forklift (maybe with another forklift on top) because the first forklift has trouble actually forklifting. Commented Dec 31, 2018 at 18:50
  • Something like this would work. Or a wrapper script to split that variable :) The other bizarre option would be to create another service to "run beforehand" and setup an EnvironmentFile, not sure how that would work with templates tho: stackoverflow.com/a/42841480/32453 Commented Jul 6, 2020 at 15:18
  • 2
    @DavidTonhofer How would a solution without "double forklifter" look like? I see that the bash is there to setup and mangle %i into USE_GPU. Then exec replaces the shell process with the real one. Commented Feb 10, 2021 at 13:34
  • @DavidTonhofer Yes, it's like using a forklift on top of a forklift. It's a canonical solution to the problem, tho. System V style init scripts were much, much worse. Commented Dec 9, 2024 at 2:13