# GracefulKiller #
**GracefulKiller** python3 module for process SIGTERM, SIGHUP and SIGINT signals gracefully
## Requirements ##
* signal (build-in)
## Details ##
### Preparations ###
Install GracefulKiller using pip:
```bash
pip install [--user] gracefulkiller
```
### Usage ###
Import module:
```python
from GracefulKiller import GracefulKiller
```
Example 1
```python
# import module
from GracefulKiller import GracefulKiller
# create killer
killer = GracefulKiller()
# create while loop using killer, will exit from loop if SIGTERM or SIGINT received
while not killer.kill_now:
# do stuff
```
Example 2
```python
# import module
from GracefulKiller import GracefulKiller
# create killer
killer = GracefulKiller()
# use it as check for SIGTERM and SIGINT
if killer.kill_now:
sys.exit()
```
Example 3
```python
# import module
from GracefulKiller import GracefulKiller, Loop
# shutdown handler
def shutdown_handler():
print("shutdown")
# create killer with shutdown handler
killer = GracefulKiller(shutdown_handler)
# start killer loop
Loop(killer, 1).start()
```
### Maintainers ###
Special thanks to:
* [williams824](https://github.com/williams824) Pull request #1: [There is no SIGHUP signal under windows](https://github.com/MaxMaxoff/GracefulKiller/pull/1)
* [cuihairu](https://github.com/cuihairu) Pull request #3: [a simple loop](https://github.com/MaxMaxoff/GracefulKiller/pull/3)
Raw data
{
"_id": null,
"home_page": "https://github.com/MaxMaxoff/GracefulKiller",
"name": "GracefulKiller",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "SIGTERM, SIGINT, SIGHUP, GracefulKiller, Killer, Graceful",
"author": "Maxim Toropov",
"author_email": "maxim.vt@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a1/e4/7ac0916dca74e178389fe10e930e10230dc5571a3364540646fa38ab5768/gracefulkiller-0.4.7.tar.gz",
"platform": null,
"description": "# GracefulKiller #\n\n**GracefulKiller** python3 module for process SIGTERM, SIGHUP and SIGINT signals gracefully\n\n## Requirements ##\n\n* signal (build-in)\n\n## Details ##\n\n### Preparations ###\n\nInstall GracefulKiller using pip:\n\n```bash\npip install [--user] gracefulkiller\n```\n\n### Usage ###\n\nImport module:\n\n```python\nfrom GracefulKiller import GracefulKiller\n```\n\nExample 1\n\n```python\n# import module\nfrom GracefulKiller import GracefulKiller\n\n# create killer\nkiller = GracefulKiller()\n\n# create while loop using killer, will exit from loop if SIGTERM or SIGINT received\nwhile not killer.kill_now:\n # do stuff\n```\n\nExample 2\n\n```python\n# import module\nfrom GracefulKiller import GracefulKiller\n\n# create killer\nkiller = GracefulKiller()\n\n# use it as check for SIGTERM and SIGINT\nif killer.kill_now:\n sys.exit()\n```\n\nExample 3\n\n```python\n# import module\nfrom GracefulKiller import GracefulKiller, Loop\n\n# shutdown handler\ndef shutdown_handler():\n print(\"shutdown\")\n \n# create killer with shutdown handler\nkiller = GracefulKiller(shutdown_handler)\n\n# start killer loop\nLoop(killer, 1).start()\n\n```\n\n### Maintainers ###\n\nSpecial thanks to:\n\n* [williams824](https://github.com/williams824) Pull request #1: [There is no SIGHUP signal under windows](https://github.com/MaxMaxoff/GracefulKiller/pull/1)\n* [cuihairu](https://github.com/cuihairu) Pull request #3: [a simple loop](https://github.com/MaxMaxoff/GracefulKiller/pull/3)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "module for process SIGTERM, SIGHUP and SIGINT signals gracefully",
"version": "0.4.7",
"project_urls": {
"Download": "https://github.com/MaxMaxoff/GracefulKiller/archive/v0.4.7.tar.gz",
"Homepage": "https://github.com/MaxMaxoff/GracefulKiller"
},
"split_keywords": [
"sigterm",
" sigint",
" sighup",
" gracefulkiller",
" killer",
" graceful"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1b8552618791684f92f8b0e44a826c430d78d93a206851906a4dc1d09b545aec",
"md5": "bbf246a090cf59c570b25dc7fb622673",
"sha256": "28c3b5c54e132350c2e6fc48300e113d2428e0cb6ede65a769d65d4dbfe10b7c"
},
"downloads": -1,
"filename": "GracefulKiller-0.4.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bbf246a090cf59c570b25dc7fb622673",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3710,
"upload_time": "2024-07-24T06:25:26",
"upload_time_iso_8601": "2024-07-24T06:25:26.877033Z",
"url": "https://files.pythonhosted.org/packages/1b/85/52618791684f92f8b0e44a826c430d78d93a206851906a4dc1d09b545aec/GracefulKiller-0.4.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a1e47ac0916dca74e178389fe10e930e10230dc5571a3364540646fa38ab5768",
"md5": "ea9f08b68a72202b1e6b1513ad5e27f8",
"sha256": "671678724bb07d2afcee45977229decbf230cb4fa9a916afcc19c810ef4420f4"
},
"downloads": -1,
"filename": "gracefulkiller-0.4.7.tar.gz",
"has_sig": false,
"md5_digest": "ea9f08b68a72202b1e6b1513ad5e27f8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3726,
"upload_time": "2024-07-24T06:25:29",
"upload_time_iso_8601": "2024-07-24T06:25:29.214448Z",
"url": "https://files.pythonhosted.org/packages/a1/e4/7ac0916dca74e178389fe10e930e10230dc5571a3364540646fa38ab5768/gracefulkiller-0.4.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-24 06:25:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MaxMaxoff",
"github_project": "GracefulKiller",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "gracefulkiller"
}