how to do a graceful uwsgi reload via bash script?

Solution 1:

SIGHUP

You can restart uWSGI by sending the SIGHUP signal to your uWSGI process like so:

kill -HUP <process-id>

If you want to automate this in a bash script, you can have uWSGI write away it's process id by supplying the pidfile option, for example like:

--pidfile=/tmp/uwsgi.pid

Then you can reload the process by:

uwsgi --reload /tmp/uwsgi.pid

touch-reload

You can also start uWSGI with the touch-reload argument, which specifies a file that when touched makes uWSGI reload:

--touch-reload=/some/file

Then uWSGI will reload when you touch the file:

touch /some/file

Remember that you can only reload uWSGI when it's running with the master process mode, but that's usually the case though.

More information: http://uwsgi-docs.readthedocs.io/en/latest/Management.html#reloading-the-server