Skip to content

Instantly share code, notes, and snippets.

@mywaiting
mywaiting / graceful_shutdown_tornado_web_server.py
Last active Dec 6, 2021
The example to how to shutdown tornado web server gracefully...
View graceful_shutdown_tornado_web_server.py
#!/usr/bin/env python
"""
How to use it:
1. Just `kill -2 PROCESS_ID` or `kill -15 PROCESS_ID` , The Tornado Web Server Will shutdown after process all the request.
2. When you run it behind Nginx, it can graceful reboot your production server.
3. Nice Print in http://weibo.com/1682780325/zgkb7g8k7
"""