这是我的服务文件:

[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。

最佳答案

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

我可能使用了较新的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 &&

关于django - systemctl奇怪的错误: Invalid arguments,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42203720/

10-09 20:07