shell script to graceful restart gunicorn with source code reloading

Est at 
I always thought restart gnicorn is as easy as kill -HUP , but there are two pitfalls: First of all the code might be loaded in master process then fork'ed into workers, so the HUP signal won't reload the source code, only gunicorn config is updated. Then there might be ………