我創建了/etc/systemd/system/
名爲"puma.service"
具有下列內容的服務腳本:我啓用了服務,開始的時候,我從systemctl得到以下日誌無法爲彪馬
[Unit]
Description=Puma HTTP Server
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/username/appdir/current
ExecStart=/bin/bash -lc "/home/username/appdir/current/sbin/puma -C /home/username/appdir/current/config/puma.rb /home/username/appdir/current/config.ru"
Restart=always
[Install]
WantedBy=multi-user.target
:
● puma.service - Puma HTTP Server
Loaded: loaded (/etc/systemd/system/puma.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Wed 2016-12-14 10:09:46 UTC; 12min ago
Process: 16889 ExecStart=/bin/bash -lc cd /home/username/appdir/current && bundle exec puma -C /home/username/appdir..
Main PID: 16889 (code=exited, status=127)
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Main process exited, code=exited, status=127/n/a
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Unit entered failed state.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Failed with result 'exit-code'.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Service hold-off time over, scheduling restart.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: Stopped Puma HTTP Server.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Start request repeated too quickly.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: Failed to start Puma HTTP Server.
雖然,當我在SSH終端中發出命令時服務器啓動並運行完美。服務文件中是否有任何更改?
注:
- 我已經改變了dirnames中爲您提供方便。
- 我做了一些研究,並且狀態127的原因是由於可執行文件不在路徑中。但是,我想這不會是一個問題。
你能說點什麼嗎?
任何想法,如果這應該在rvm工作不同?我試過在rvm中使用相應的路徑,仍然得到相同的結果 – unclesol
對不起,我不知道。從未嘗試rvm,我所有的部署腳本都在rbenv中。 –