【问题标题】:Executable path is not absolute, ignoring: $(which node)可执行路径不是绝对的,忽略:$(which node)
【发布时间】:2018-07-18 23:06:35
【问题描述】:

想法是使用指向节点的变量而不是硬编码路径,我的解决方案是ExecStart="$(which node)" /home/jonma/Development/chewy

但是当我运行该服务时,我收到以下错误:

feb 08 11:12:51 jonma-VirtualBox systemd[1]: [/lib/systemd/system/chewy.service:2] Executable path is not absolute, ignoring: $(which node) /home/jon
feb 08 11:12:51 jonma-VirtualBox systemd[1]: chewy.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.

如何在不硬编码路径的情况下实现这一点?

【问题讨论】:

标签: linux debian systemd


【解决方案1】:

systemd 不会接受没有给出绝对路径的命令,所以要完成你想要的,你需要依赖 bash-ism 并执行以下操作之一:

ExecStart=/bin/bash -c '$$(which node) /home/jonma/Development/chewy'

ExecStart=/bin/bash -c '`which node` /home/jonma/Development/chewy'

(我更喜欢第一个,但你可以做任何事情)

【讨论】:

    猜你喜欢
    • 2023-03-30
    • 1970-01-01
    • 2018-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-12
    • 1970-01-01
    相关资源
    最近更新 更多