Created
May 9, 2017 10:54
-
-
Save klingtnet/6ad92343505dfc4edc283ffa2f962f1a to your computer and use it in GitHub Desktop.
Python signal handling
This file contains 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
#!/usr/bin/env python3 | |
import signal | |
import sys | |
import time | |
def handler(signr, stackframe): | |
print("Killed with {}".format(signr)) | |
sys.exit(1) | |
signal.signal(signal.SIGUSR1, handler) | |
print("Sleeping for 1000 seconds...") | |
time.sleep(1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment