测试python响应SIGTERM的代码

#!
import time, signal

quit = False
def shutdown_all(signum, frame):
  global quit
  quit = True

if __name__=="__main__":
  signal.signal(signal.SIGTERM, shutdown_all)

  while not quit:
    time.sleep(1)
  
  print 'graceful quit'


验证通过

你可能感兴趣的:(java,python)