2017-02-13 131 views
1

這是我的服務文件:systemctl奇怪的錯誤:無效的參數

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

回答

0

也許你現在已經知道了,但在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 &&