for child_pid of gunicorn-master: kill child_pid wait for app startup
echo 'Killing children of ' $1; children=$(pgrep -P $1) for child in $children do echo 'Killing' $child kill $child response=$(timeout 60 nc -w 0 -ul 4012) if [ "$response" != '200 OK' ]; then echo 'BROKEN' exit 1; fi done
import socket
import time
def post_worker_init(worker):
_send_udp('200 OK\n')
def _send_udp(message):
udp_ip = "127.0.0.1"
udp_port = 4012
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(message, (udp_ip, udp_port))
如果我们有这样一个WSGI( Python Web Server Gateway Interface)应用:
from werkzeug.wrappers import Request, Response
@Request.application
def application(request):
resp = Response('Hello World!')
if request.path == '/_status':
resp.status = '200 OK'
else:
resp.status ='404 Not Found'
return resp
def post_worker_init(worker):
env = {
'REQUEST_METHOD': 'GET',
'PATH_INFO': '/_status',
}
def start_response(*args, **kwargs):
_send_udp(args[0])
worker.wsgi(env, start_response)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有