hsf*_*xjy 4 django ubuntu systemctl daphne
这是我的服务文件:
[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
Run Code Online (Sandbox Code Playgroud)
当我执行时,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.
Run Code Online (Sandbox Code Playgroud)
和的结果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)
Run Code Online (Sandbox Code Playgroud)
怎么了?我正在使用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"
Run Code Online (Sandbox Code Playgroud)
此外,您可能会考虑WorkingDirectory在服务中使用一行,而不是cd &&
通常,要调试“无效参数”的确切原因,可以使用:
sudo systemd-analyze verify daphnei.service
或在用户的本地服务的情况下:
sudo systemd-analyze --user verify daphnei.service
| 归档时间: |
|
| 查看次数: |
11182 次 |
| 最近记录: |