Supervisord 不会启动被杀死的进程

发布于 2024-12-12 06:48:51 字数 855 浏览 0 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌逼全场 2024-12-19 06:48:51

尝试设置 autorestart=true。默认情况下,自动重新启动设置为“意外”,这意味着只有当进程以意外的退出代码退出时,它才会重新启动进程。默认情况下,预计退出代码为 0。

http://supervisord.org/configuration.html#program-x-section-设置

您可以使用 chkconfig 程序来确保 Supervisor 在重新启动时启动。

$ sudo apt-get install chkconfig
$ chkconfig -l supervisor
supervisor                0:off  1:off  2:on   3:on   4:on   5:on   6:off

您可以看到,当我安装它时,它默认启用运行级别 2-5。

$ man 7 runlevel

有关运行级别的更多信息。

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.

$ sudo apt-get install chkconfig
$ chkconfig -l supervisor
supervisor                0:off  1:off  2:on   3:on   4:on   5:on   6:off

You can see that it's enabled for runlevels 2-5 by default when I installed it.

$ man 7 runlevel

for more info on run levels.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文