我正在尝试在一台我没有 root 访问权限的 RHEL 服务器上设置 Supervisord。当我通过 SSH 进入服务器并运行 Supervisord 时,一切似乎都正常工作:当我运行 ps 时,supervisord 和它启动的两个程序不会出现,但当我运行 ps -A 时会出现。我可以看到程序的输出,supervisorctl 报告它们正在运行,等等。但是,一旦我退出 SSH 会话,supervisord 和两个客户端程序就会被终止,不再显示在 ps -A 下,等等。当我退出 SSH 会话并在配置文件中使用 nodaemon=false 运行 Supervisord 时,supervisord 日志文件中没有任何事件(见下文)。我是否做错了什么或在配置文件中设置不正确?如果需要更多详细信息,请告诉我。
我用来启动supervisord的命令:
/home/foo/.local/bin/supervisord
输出ps -f
:
UID PID PPID C STIME TTY TIME CMD
foo 1 0 0 09:11 ? 00:00:00 -jailshell
foo 53 1 0 09:11 ? 00:00:00 ps -f
[unix_http_server]
file=/tmp/supervisor.sock ; the path to the socket file
[supervisord]
logfile=/home/foo/logs/supervisord.log ; main log file; default
$CWD/supervisord.log
logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
loglevel=trace ; log level; default info; others: debug,warn,trace
pidfile=/home/foo/.local/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false ; start in foreground if true; default false
minfds=50 ; min. avail startup file descriptors; default 1024
minprocs=25 ; min. avail process descriptors;default 200
directory=/home/foo/foo_bar/ ; default is not to cd during start
; The rpcinterface:supervisor section must remain in the config file for
; RPC (supervisorctl/web interface) to work. Additional interfaces may be
; added by defining them in separate [rpcinterface:x] sections.
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
; The supervisorctl section configures how supervisorctl will connect to
; supervisord. configure it match the settings in either the unix_http_server
; or inet_http_server section.
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
; The sample program section below shows all possible program subsection values.
; Create one or more 'real' program: sections to be able to control them under
; supervisor.
[program:foo]
command=/home/foo/foo_bar/foo.py ; the program (relative uses PATH, can take args)
[program:bar]
command=/home/foo/foo_bar/bar.py ; the program (relative uses PATH, can take args)
答案1
您可以byobu
在类似 Debian 的系统(Ubuntu)上使用。即使您关闭连接,它也能让您的会话保持完全活动状态SSH
。