加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

Supervisord不会启动被杀死的进程

发布时间:2020-12-13 19:18:36 所属栏目:Linux 来源:网络整理
导读:我在我的Ubuntu 10.04上安装了supervisord,它不断运行 Java进程,并且当它以某种方式死亡或崩溃时应该治愈(重新加载)进程. 在我的htop上,我将SIGKILL,SIGTERM,SIGHUP,SIGSEGV信号发送到该Java进程并观察/etc/logs/supervisord.log文件. 08:09:46,182 INFO suc
我在我的Ubuntu 10.04上安装了supervisord,它不断运行 Java进程,并且当它以某种方式死亡或崩溃时应该治愈(重新加载)进程.

在我的htop上,我将SIGKILL,SIGTERM,SIGHUP,SIGSEGV信号发送到该Java进程并观察/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作为服务,以便它在整个系统重新启动时自动启动?

解决方法

尝试设置autorestart = true.默认情况下,autorestart设置为“unexpected”,这意味着只有在存在意外退出代码的情况下才会重新启动进程.默认情况下,退出代码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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读