干净利落地终止进程。发送一个SIGTERM信号,等待它死掉,如果没有,SIGKILL进程树中从较高(最近)到较低(以前)的PID值的所有子进程。
ckill的Python项目详细描述
允许安全、干净地终止多进程应用程序的实用程序 当SIGTERM为 收到。在
ckill向主进程发送一个SIGTERM信号,等待它死,如果 它不会在一段时间后,SIGKILL进程树中的所有子进程 从较高(最近)到较低(以前)的PID值。在
通过这种方式,ckill允许进程正确终止,但是如果 终止时发生故障,或如果需要太长时间(由 user)它的所有子进程被终止,然后主进程本身被终止,离开 后面没有僵尸进程。在
如果要开发Python多进程应用程序,请参见 https://github.com/kuralabs/multiexit
安装
pip3 install ckill
(可选)安装以下软件包以启用颜色日志输出。在
^{pr2}$使用
usage: ckill [-h] [-v] [--version] [--no-color] [--timeout-s TIMEOUT_S] PID Cleanly kills a process positional arguments: PID PID of process to kill optional arguments: -h, --help show this help message and exit -v, --verbose Increase verbosity level --version show program's version number and exit --no-color Do not colorize the log output --timeout-s TIMEOUT_S Maximum time to wait for the process to die, in seconds.
变更日志
1.0.1(2020-12-01)
- 修复错误的psutil API调用。在
1.0.0(2020-10-15)
- 初始版本。在
许可证
Copyright (C) 2020 KuraLabs S.R.L Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- 项目
标签: