supervisor 的使用范围有限制吗?
- 0次
- 2021-07-09 19:15:35
- idczone
系统:Debian 7 64bit
在 /etc/supervisor/conf.d 下放有两个 conf 文件,一个 ss.conf ,一个 mytest.conf 。
ss.conf 和 mytest.conf 分别为:
[program:ss]
command=/usr/local/bin/ssserver -c /etc/ss.json
autorestart=true
user=root
[program:mytest]
command=/usr/bin/mytest
autorestart=true
user=root
运行supervisorctl reload,日志如下:
2015-08-01 09:27:14,124 CRIT Supervisor running as root (no user in config file)
2015-08-01 09:27:14,124 WARN Included extra file "/etc/supervisor/conf.d/ss.conf" during parsing
2015-08-01 09:27:14,124 WARN Included extra file "/etc/supervisor/conf.d/mytest.conf" during parsing
2015-08-01 09:27:14,124 INFO RPC interface 'supervisor' initialized
2015-08-01 09:27:14,124 WARN cElementTree not installed, using slower XML parser for XML-RPC
2015-08-01 09:27:14,124 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2015-08-01 09:27:14,124 INFO supervisord started with pid 14297
2015-08-01 09:27:15,126 INFO spawned: 'ss' with pid 14956
2015-08-01 09:27:15,127 INFO spawned: 'mytest' with pid 14957
2015-08-01 09:27:15,135 INFO exited: mytest (exit status 1; not expected)
2015-08-01 09:27:16,326 INFO success: ss entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2015-08-01 09:27:16,327 INFO spawned: 'mytest' with pid 14970
2015-08-01 09:27:16,331 INFO exited: mytest (exit status 1; not expected)
2015-08-01 09:27:19,073 INFO spawned: 'mytest' with pid 14973
2015-08-01 09:27:19,077 INFO exited: mytest (exit status 1; not expected)
2015-08-01 09:27:22,935 INFO spawned: 'mytest' with pid 14975
2015-08-01 09:27:22,939 INFO exited: mytest (exit status 1; not expected)
2015-08-01 09:27:23,940 INFO gave up: mytest entered FATAL state, too many start retries too quickly
从日志中可以看到,mytest 总是 abnormal termination 异常终止!
file mytest ,返回如下:
/usr/bin/mytest: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
这个mytest直接运行没有成功或者是错误提示,ps -ef |grep mytest ,进程存在。
现在的疑问是,mytest 是否是守护进程?supervisor是否不能对守护进程进行监视?
谢谢答疑!
手动运行mystart的话,是不是会立刻返回?那就是fork到后台了,fork出来的进程当然无法识别。有几种办法
查查mystart文档,有没有foreground或者不fork的选项
使用pid文件,配置supervisor
另外,自从用了systemd,就再没用过其他了
手动运行mystart的话,是不是会立刻返回?那就是fork到后台了,fork出来的进程当然无法识别。有几种办法
查查mystart文档,有没有foreground或者不fork的选项
使用pid文件,让supervisor识别
另外,systemd大法好
supervisor不能对守护进程进行监视,mytest自己本身就是守护进程
如果你要用supervisor统一管理就要加参数前台执行
谢谢,确实有 foreground 和 pid 选项,supervisorctl reload 之后能够启动进程,但 kill 之后,不能自动重启。
通过强制foreground终于弄好了,谢谢两位!
systemd大法+1. cgroup 是很棒的特性,还有 subreaper 也是,可 supervisord 还不支持。
kill不能重启应该也是supervisor配置问题,查查控制重启的选项
谢谢介绍,systemd 还没有接触过,找时间看看这个争议比较大的启动管理。
启用 foreground 之后,可以正常启动了,谢谢您一而再,再而三的解答,1024个赞!
supervisor , daemontools这类服务管理工具都要求是前台运行的
楼主用supervisor 好吧 看看我的问题
我的是起不来http://v2ex.com/t/210122#reply10
您好,您的问题出现在 supervisor 启动失败,修改一下 config 中的 supervisor.sock 路径,可以参考一下这篇文章:
http://lixcto.blog.51cto.com/4834175/1539136
希望对您有用。