主管在杀死-9后不杀死子进程

时间:2018-07-19 11:25:03

标签: linux configuration-files supervisord supervisor

我试图通过超级用户在计算机上运行两个脚本。但是,当我从终端对主管(杀死)执行不正常的关闭时,子进程将进入init。另外,有时在我重启脚本后,其中只有一个脚本终止并且其中一个脚本具有多个实例。这是我的配置文件:

[unix_http_server]
file=/tmp/supervisor.sock   ; the path to the socket file
;chmod=0700                 ; socket file mode (default 0700)
;chown=nobody:nogroup       ; socket file uid:gid owner
;username=user              ; default is no username (open server)
;password=123               ; default is no password (open server)

[inet_http_server]         ; inet (TCP) server disabled by default
port=127.0.0.1:9001        ; ip_address:port specifier, *:port for all iface
;username=user              ; default is no username (open server)
;password=123               ; default is no password (open server)

[supervisord]
logfile=/tmp/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=info                ; log level; default info; others: debug,warn,trace
pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false               ; start in foreground if true; default false
minfds=1024                  ; min. avail startup file descriptors; default 1024
minprocs=200                 ; min. avail process descriptors;default 200
;umask=022                   ; process file creation umask; default 022
;user=chrism                 ; default is current user, required if root
;identifier=supervisor       ; supervisord identifier, default is 'supervisor'
;directory=/tmp              ; default is not to cd during start
;nocleanup=true              ; don't clean up tempfiles at start; default false
;childlogdir=/tmp            ; 'AUTO' child log dir, default $TEMP
;environment=KEY="value"     ; key value pairs to add to environment
;strip_ansi=false            ; strip ansi escape codes in logs; def. false

; 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
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris              ; should be same as in [*_http_server] if set
;password=123                ; should be same as in [*_http_server] if set
;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
;history_file=~/.sc_history  ; use readline history if available



[program:foo]
command=/usr/bin/python2.7 /home/lab/example1.py
stopsignal=KILL
stopwaitsecs=10
stopasgroup=true
killasgroup=true

[program:foo1]
command=/usr/bin/python2.7 /home/lab/example2.py
stopsignal=KILL
stopwaitsecs=10
stopasgroup=true
killasgroup=true

; The sample group section below shows all possible group values.  Create one
; or more 'real' group: sections to create "heterogeneous" process groups.

;[group:thegroupname]
;programs=progname1,progname2  ; each refers to 'x' in [program:x] definitions
;priority=999                  ; the relative start priority (default 999)

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.

;[include]
;files = relative/directory/*.ini

我正在使用stopasgroup和killasgroup。这是我杀死后得到的输出:

[root@bm-41 lab]# ps -eaf | grep example
root     38419 38404  0 02:53 ?        00:00:00 /usr/bin/python2.7 /home/lab/example1.py
root     38420 38404  0 02:53 ?        00:00:00 /usr/bin/python2.7 /home/lab/example2.py
root     38422 37972  0 02:53 pts/0    00:00:00 grep --color=auto example
[root@bm-41 lab]# kill -9 38404
[root@bm-41 lab]# ps -eaf | grep example
root     38419     1  0 02:53 ?        00:00:00 /usr/bin/python2.7 /home/lab/example1.py
root     38420     1  0 02:53 ?        00:00:00 /usr/bin/python2.7 /home/lab/example2.py
root     38424 37972  0 02:53 pts/0    00:00:00 grep --color=auto example

脚本进入初始化。如果脚本用于有限的迭代,则它们将在一段时间后终止。但是我要运行的真正软件包必须一直运行,直到我更改它,这才是我遇到错误的地方。

0 个答案:

没有答案