根据Apache documentation,WINCH信号可用于优雅地停止Apache。
所以看起来,在supervisord中,我应该能够使用stopsignal = WINCH来配置supervisord以优雅地停止Apache。
然而,谷歌因“stopsignal = WINCH”而获得0结果。似乎很奇怪,之前没人试过这个。
只是想确认一下:stopignal = WINCH是让supervisord优雅地停止Apache的方式吗?
答案 0 :(得分:0)
我在Docker容器中的; 4 pairs counted with wrong way, 3 with correct way
(define l1 (list 1 2))
(define l2 (list 3))
(set-car! l1 l2)
(set-cdr! l2 (cdr l1))
; 7 pairs counted with the wrong way, 3 with correct way
(define y1 (list 1))
(define y2 (list 1))
(define y3 (list 1))
(set-car! y1 y2)
(set-cdr! y1 y2)
(set-car! y2 y3)
(set-cdr! y2 y3)
下运行/停止apache2
时遇到了同样的问题。我不知道您的问题是否与Docker有关,或者您对Docker的熟悉程度如何。只是为了给你一些上下文:当调用supervisord
时,Docker将docker stop <container-name>
发送到在容器(some details on the topic)内运行PID 1的进程,在本例中为SIGTERM
。我希望supervisord
将信号传递给它的所有程序以优雅地终止它们,因为我意识到,如果你没有优雅地终止supervisord
,你可能无法重新启动它,因为PID文件没有删除。无论有没有apache2
,我都试过了,结果对我没有改变。在这两种情况下,stopsignal=WINCH
被轻轻终止(退出状态为0且apache2
中没有PID文件。为了保持安全,我将/var/run/apache2
保留在stopsignal=WINCH
配置中,但截至今天,我也无法在网上找到一个明确的答案,既不是在这里也不是通过谷歌搜索。
答案 1 :(得分:0)
根据主管的source代码:
# all valid signal numbers
SIGNUMS = [ getattr(signal, k) for k in dir(signal) if k.startswith('SIG') ]
def signal_number(value):
try:
num = int(value)
except (ValueError, TypeError):
name = value.strip().upper()
if not name.startswith('SIG'):
name = 'SIG' + name
num = getattr(signal, name, None)
if num is None:
raise ValueError('value %r is not a valid signal name' % value)
if num not in SIGNUMS:
raise ValueError('value %r is not a valid signal number' % value)
return num
它可以识别所有信号,即使您的信号名称不是以“ SIG”开头,它也会自动添加。