Supervisord 不会启动被杀死的进程
我在 Ubuntu 10.04 上安装了supervisord,它连续运行一个 Java 进程,并且当它以某种方式死亡或崩溃时应该修复(重新加载)进程。
在我的 htop
上,我向该 Java 进程 发送 SIGKILL、SIGTERM、SIGHUP、SIGSEGV 信号,并观看 /etc/logs/supervisord.log
文件和它说。
08:09:46,182 INFO success: myprogram entered RUNNING state,[...]
08:38:10,043 INFO exited: myprogram (exit status 0; expected)
08:38
我用 SIGSEGV 终止了该进程。为什么它会以代码 0 退出,并且为什么 supervisord
根本不重新启动它?
我关于这个特定程序的所有 supervisord.conf
如下:
[program:play-9000]
command=play run /var/www/myprogram/ --%%prod
stderr_logfile = /var/log/supervisord/myprogram-stderr.log
stdout_logfile = /var/log/supervisord/myprogram-stdout.log
当我启动supervisord 时,进程工作得很好,但是没有得到修复。
顺便问一下,有什么想法如何将supervisord作为服务启动,以便它在整个系统重新启动时自动启动吗?
I have supervisord
installed on my Ubuntu 10.04 and it runs a Java process continuously and supposed to heal (reload) process when it somehow dies or crashes.
On my htop
I send SIGKILL, SIGTERM, SIGHUP, SIGSEGV signals to that Java process and watch /etc/logs/supervisord.log
file and it says.
08:09:46,182 INFO success: myprogram entered RUNNING state,[...]
08:38:10,043 INFO exited: myprogram (exit status 0; expected)
At 08:38
I kill the process with SIGSEGV. How come it is exited with code 0 and why does not supervisord
restart it at all?
All my supervisord.conf
about this specific program is as follows:
[program:play-9000]
command=play run /var/www/myprogram/ --%%prod
stderr_logfile = /var/log/supervisord/myprogram-stderr.log
stdout_logfile = /var/log/supervisord/myprogram-stdout.log
Process works really fine when I launch supervisord, however does not get healed.
By the way any ideas how to start supervisord as a service so that it automatically launches when the whole system reboots?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试设置
autorestart=true
。默认情况下,自动重新启动设置为“意外”,这意味着只有当进程以意外的退出代码退出时,它才会重新启动进程。默认情况下,预计退出代码为 0。http://supervisord.org/configuration.html#program-x-section-设置
您可以使用 chkconfig 程序来确保 Supervisor 在重新启动时启动。
您可以看到,当我安装它时,它默认启用运行级别 2-5。
有关运行级别的更多信息。
Try setting
autorestart=true
. By default, autorestart is set to "unexpected" which means it will only restart a process if it exits with an unexpected exit code. By default, exit code 0 is expected.http://supervisord.org/configuration.html#program-x-section-settings
You can use the chkconfig program to make sure that supervisor starts on reboot.
You can see that it's enabled for runlevels 2-5 by default when I installed it.
for more info on run levels.