Supervisord-自动终止其衍生的进程

Supervisord-自动终止其衍生的进程

我是 Supervisord 的新手。我在 Ubuntu 上。

我的问题是,我有一个脚本,使用“exec java -cp .....”作为脚本中的唯一一行来生成 java 进程。这个特定的 java 进程是一个非守护进程,可以无限期地运行(因为“驱动程序”始终处于运行状态,如果我直接调用启动脚本,我也检查过它是否按预期工作)。

但是我已经将supervisord.conf文件配置为

[program:mydriver]
command=/home/subho/Workshop/start.sh
directory=/home/subho/Workshop
startsecs=5
stdout_logfile=/home/subho/Workshop/Logs/out.log
stderr_logfile=/home/subho/Workshop/Sink/Logs/err.log

但当我开始 ./supervisord -c <path to my conf file>

该进程正确启动,一旦进入运行状态,它就会被主管自动终止。以下是日志,

2017-06-03 18:58:05,286 CRIT Supervisor running as root (no user in config file)
2017-06-03 18:58:05,297 INFO RPC interface 'supervisor' initialized
2017-06-03 18:58:05,297 CRIT Server 'unix_http_server' running without any 
HTTP authentication checking
2017-06-03 18:58:05,297 INFO daemonizing the supervisord process
2017-06-03 18:58:05,298 INFO supervisord started with pid 19698
2017-06-03 18:58:06,300 INFO spawned: 'mydriver' with pid 19699
2017-06-03 18:58:11,671 INFO success: mydriver entered RUNNING state, process has stayed up for > than 5 seconds (startsecs)
2017-06-03 18:58:27,439 INFO waiting for mydriver to die
2017-06-03 18:58:27,465 INFO stopped: mydriver (exit status 143)

为什么会这样?当我启动 tomcat 或任何其他进程时也会发生同样的情况。

答案1

我不知道这是不是正确的原因。但这解决了我的问题。

我将 conf 文件保存在自定义路径下。supervisor conf 文件的默认路径位于 /etc/supervisor/ 下。当我使用默认 conf 文件(并在 /etc/supervisor/conf.d/myconf.conf 下添加我的自定义 conf 文件)时,它按预期工作。

相关内容