Skip to content

正确关闭服务

778477 edited this page May 22, 2017 · 3 revisions

因为 dumplings 基于egg开发,启动过程中会拉起master,agent,worker这三类进程。

具体内容可以参考egg文档-多进程模型和进程间通讯,dumplings控制了worker数量为1.

请求 127.0.0.1:portNumber/exit 应用内部调用process.exit(0) 来结束应用程序生命

通过指定的端口号找出监听该端口的master进程号,进而完整关闭服务

#===============================================
# Copyright (C) 2017 All rights reserved.
#=============================================== 
# Filename:   killTargetProcess.sh
# Author:     miaoyou.gmy
# Date:       2017-03-07
# Description: 
# 
# Modification: 
# 
#===============================================
#!/bin/bash


PORT=$1


kill -9 $(lsof -i:$PORT -t) 2> /dev/null
Clone this wiki locally