Created
May 26, 2021 15:32
-
-
Save alecbw/d536c7b892f800491c162df257d68e5c to your computer and use it in GitHub Desktop.
Logs SIGKILL value such that an Error Handling platform like Sentry can capture it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal | |
def shutdown(signum, frame): | |
logging.error(f'Caught SIGTERM {signum}, shutting down') | |
exit(0) | |
if __name__ == "__main__": | |
# Register handler | |
signal.signal(signal.SIGTERM, shutdown) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment