【问题标题】:systemctl strange error: Invalid argumentssystemctl 奇怪的错误:无效的参数
【发布时间】:2017-07-01 10:03:00
【问题描述】:

这是我的服务文件:

[Unit]
Description=Daphne Interface

[Service]
ExecStartPre=cd /home/git/hsfzmun/server
ExecStart=/bin/bash/ -c "cd /home/git/hsfzmun/server && /home/git/virtualenvs/hsfzmun/bin/daphne -b 0.0.0.0 -p 8001 -v2 config.asgi:channel_layer"
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target

当我执行sudo systemctl start daphnei 时,我得到:

Failed to start daphnei.service: Unit daphnei.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status daphnei.service' for details.

还有systemctl status daphnei.service的结果:

* daphnei.service - Daphne Interface
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead) (Result: exit-code) since Mon 2017-02-13 19:55:10 CST; 13min ago
 Main PID: 16667 (code=exited, status=1/FAILURE)

怎么了?我使用的是 Ubuntu Server 16.04。

【问题讨论】:

    标签: django ubuntu systemctl daphne


    【解决方案1】:

    也许您现在已经弄清楚了,但是在您的ExecStart 行中的/bin/bash 之后还有一个额外的/

    我可能有一个稍新的systemd 版本——当我尝试它时,systemctl status 的输出包含以下消息:

    Executable path specifies a directory, ignoring: /bin/bash/ -c "cd /home/git/hsfzmun/server && /home/git/virtualenvs/hsfzmun/bin/daphne -b 0.0.0.0 -p 8001 -v2 config.asgi:channel_layer"
    

    另外,您可以考虑在服务中使用WorkingDirectory 行,而不是cd &&

    【讨论】:

      【解决方案2】:

      通常,要调试“无效参数”的确切原因,您可以使用:

      sudo systemd-analyze verify daphnei.service

      或者如果是用户的本地服务:

      sudo systemd-analyze --user verify daphnei.service

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多