Skip to main content

Handling system signals and taking actions on application termination

Project description

signal_handler

Handling system signals and taking actions on application termination

Example:

#!/usr/bin/python3

from signal_handler import SignalHandler


if __name__ == '__main__':
    terminator = SignalHandler(handler=lambda: print(
        '\nOn terminate actions here!\n'))
    while True:
        if not terminator.terminated:
            print('Cycle')
        else:
            print(f"Message: {terminator.message}\n"
                  f"Traceback: {terminator.traceback}\n"
                  f"Signal name: {terminator.signal_name}")
            break

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

signal_handler-0.0.5.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

signal_handler-0.0.5-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file signal_handler-0.0.5.tar.gz.

File metadata

  • Download URL: signal_handler-0.0.5.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for signal_handler-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ebbcb5ac796588c6a0028b2b24d52176500bd95794da0bd5faed39e45d19b4ac
MD5 40ec61bbffca98235209fe98811b8072
BLAKE2b-256 87ec1dd2c6bfd215f17afd77358c073996a7e17bf0fddd7fa5e03656437184a4

See more details on using hashes here.

File details

Details for the file signal_handler-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for signal_handler-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 36e6f7a1a5a1b3ac1c78f6c4334cc050b8313c1a2bbba5040fef6cd26bbd2f4a
MD5 2a6703b00f30ae8a301d821f9639631f
BLAKE2b-256 6533165b08fecb51726eeb2b1c8eff57ed54b9bc58afdfa3b9325a216d6f72d8

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