Skip to content

Instantly share code, notes, and snippets.

@nattster
Created June 5, 2013 14:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nattster/5714371 to your computer and use it in GitHub Desktop.
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.
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