supervisor ERROR (spawn error)

时间:2019-02-11
本文章向大家介绍supervisor ERROR (spawn error),主要包括supervisor ERROR (spawn error)使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

在supervisor中配置的进程无法正常启动

supervisorctl status 
可以看到运行状态,

cerebro                          FATAL     Exited too quickly (process log may have details)

这里的信息太少,我们需要到具体的日志中查看到底出了什么问题。

tail -20 /var/log/supervisord.log

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

这里的信息虽然多了些,但是并没有实质性的内容。

到底启动的时候发生了什么呢

supervisorctl tail programname stdout 
该命令是动态的输出启动进程时的输出

/usr/bin/env: bash: Not a directory

发现环境变量没有正确配置。

我其实已经在/etc/profile中配置了java的环境变量,但是没有效果。

因为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