【问题标题】:Supervisord does not start killed processesSupervisord 不会启动被杀死的进程
【发布时间】:2011-12-15 16:58:56
【问题描述】:

我在我的 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 作为服务启动,以便在整个系统重新启动时自动启动?

【问题讨论】:

    标签: supervisord


    【解决方案1】:

    尝试设置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
    

    你可以看到我安装的时候默认启用了runlevels 2-5。

    $ man 7 runlevel
    

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

    【讨论】:

    • 太棒了!我正在寻找这个autorestart 设置。我期待它默认为true,然后我迷失在文档中。顺便说一句,我认为chkconfig 需要一个进程作为服务,但是supervisord 不是服务,因此chkconfig -l 命令对我不起作用并说supervisor: unrecognized service。您对此有何看法?
    • 你是如何安装supervisor的?如果您使用 apt-get,那么它将作为服务安装,至少对于 Ubuntu 10.04。
    • 它是在 10.04 上,我想我是使用 easy_install 安装的。感谢您注意到这一点。
    • 我已经这样做了,不起作用autostart=true autorestart=true,两者都为true
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-02
    • 2017-07-12
    • 2010-12-08
    • 2010-09-28
    • 1970-01-01
    相关资源
    最近更新 更多