Skip to main content

Cleanly kills a process. Sends a SIGTERM signal, waits for it to die, and if it doesn't, SIGKILL all its subprocesses in the process tree from higher (recent) to lower (former) PID value.

Project description

===============================
ckill - Cleanly kills a process
===============================

Utility that allows to safely and cleanly terminate a multiprocess application
that implements a shutdown, clean-up, or exit routine when a SIGTERM is
received.

ckill sends a SIGTERM signal to the main process, waits for it to die, and if
it doesn't after some timeout, SIGKILL all its subprocesses in the process tree
from higher (recent) to lower (former) PID value.

In this way, ckill allows the process to terminate correctly, but if it
malfunctions when terminating, or if it takes too much time (determined by the
user) all its subprocesses are killed and then the main process itself, leaving
no zombie processes behind.

.. image:: http://turnoff.us/image/en/dont-sigkill-2.png
:scale: 50%
:alt: DON'T SIGKILL 2
:target: http://turnoff.us/geek/dont-sigkill-2/


If you're developing a Python multiprocess application, see also
https://github.com/kuralabs/multiexit


Install
=======

.. code-block:: sh

pip3 install ckill

Optionally, install the following package to enable color log output.

.. code-block:: sh

pip3 install colorlog


Usage
=====

.. code-block:: text

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.


Repository
==========

https://github.com/kuralabs/ckill


Changelog
=========

1.0.1 (2020-12-01)
------------------

Fix
~~~

- Fix bad psutil API call.


1.0.0 (2020-10-15)
------------------

New
~~~

- Initial release.


License
=======

.. code-block:: text

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.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ckill-1.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

ckill-1.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file ckill-1.0.1.tar.gz.

File metadata

  • Download URL: ckill-1.0.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for ckill-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8aeb7570b8f5e6f6379b44cc35f5432997efa39694f2a219f39eddcddd2e3174
MD5 c248cb4ed0ebe45f2786e8069012d3d6
BLAKE2b-256 3af6a2e5e356c93b03401c09e3bb365bfa78e37f5c7fa269f7e2d7cea8e1ac58

See more details on using hashes here.

File details

Details for the file ckill-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ckill-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for ckill-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95ac92f0c961307f696071c18c6165aa3f89ac78104ef9f960dedb0bee6ab001
MD5 a2bc19bcd36cc4b6af6d6c6263bd97f9
BLAKE2b-256 0e23b65a262fabb046319ebb5c6e14ed3761c3f4cf302f393ea68d24c88f661b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page