在supervisor中配置的進程沒法正常啓動java
supervisorctl status
能夠看到運行狀態,bash
cerebro FATAL Exited too quickly (process log may have details)
這裏的信息太少,咱們須要到具體的日誌中查看到底出了什麼問題。elasticsearch
tail -20 /var/log/supervisord.logui
2017-08-07 13:23:36,829 INFO spawned: 'cerebro' with pid 16482
2017-08-07 13:23:36,863 INFO exited: cerebro (exit status 1; not expected)
2017-08-07 13:23:36,863 INFO gave up: cerebro entered FATAL state, too many start retries too quicklyspa
這裏的信息雖然多了些,可是並無實質性的內容。設計
到底啓動的時候發生了什麼呢rest
supervisorctl tail programname stdout (能解決大多問題,programname改成本身服務的名字)
該命令是動態的輸出啓動進程時的輸出日誌
/usr/bin/env: bash: Not a directory
發現環境變量沒有正確配置。進程
我其實已經在/etc/profile中配置了java的環境變量,可是沒有效果。it
由於supervisor啓動時並不會加載/etc/profile 文件。(設計自己)
可是supervisor 提供了一個配置參數enviroment
[program:cerebro]
environment = JAVA_HOME="/opt/jdk/"
command =/bin/bash /opt/cerebro/bin/cerebro
autostart =true
autorestart = true
使用
supervisorctl update
supervisorctl reload
supervisorctl status
進程正常工做
cerebro RUNNING pid 17236, uptime 0:00:08 elasticsearch RUNNING pid 17235, uptime 0:00:08