How can I use spaces in systemd command line arguments?

前端 未结 7 1532
情话喂你
情话喂你 2021-01-17 11:52

I have a systemd unit with spaces in an argument

ExecStart=command --argument=\"text text\"

It seems that systemd does not recognize the do

7条回答
  •  猫巷女王i
    2021-01-17 12:18

    This is actually surprisingly difficult to do, unfortunately. I stole this info from this answer. The only way to do it is to put your arguments in an environment file and then use them as variables as such (like in /etc/.progconfig):

    ARG1=text
    ARG2=text
    

    Then import the environment file before running your command:

    EnvironmentFile=/etc/.progconf
    ExecStart = command $ARG1 $ARG2
    

提交回复
热议问题