Created
June 5, 2013 14:43
-
-
Save nattster/5714371 to your computer and use it in GitHub Desktop.
When Python process was killed, this code will catch SIGTERM and allow us to do some finalizations.
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
import signal | |
import sys | |
def signal_term_handler(signal, frame): | |
print 'got SIGTERM' | |
sys.exit(0) | |
signal.signal(signal.SIGTERM, signal_term_handler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment