|
import signal, time, os
|
|
|
|
def shutdown(signum, frame):
|
|
print('Caught SIGTERM, shutting down')
|
|
# Finish any outstanding requests, then...
|
|
exit(0)
|
|
|
|
if __name__ == '__main__':
|
|
# Register handler
|
|
signal.signal(signal.SIGTERM, shutdown)
|
|
# Main logic goes here
|
|
|