8

我已经supervisord安装在我的 Ubuntu 10.04 上,它连续运行一个 Java 进程,并且应该在它以某种方式死亡或崩溃时修复(重新加载)进程。

在我的身上,我向那个Java 进程htop发送 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 作为服务启动,以便在整个系统重新启动时自动启动?

4

1 回答 1

13

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

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

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

$ 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

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

于 2011-10-28T16:09:03.650 回答