In python 2.6 under Linux, I can use the following to handle a TERM signal:
import signal def handleSigTERM(): shutdown() signal.signal(signal.SIGTERM, h
For Python 3:
for sig in signal.Signals: try: signal.signal(sig, sighandler) except OSError: print('Skipping', sig)