supervisor ERROR (spawn error):错误解决

在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 quickly
spa


这里的信息虽然多了些,可是并无实质性的内容。设计

到底启动的时候发生了什么呢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  

相关文章
相关标签/搜索