How to kill all instances of uwsgi

I am trying to upload my project to the server. There is already a project on the server. I have a new project that I want to start and replace the old project with a new one, so I pull the new project to the server. Then I activate the virtual environment and do all the necessary work. Then when I try to run the command:

uwsgi --plugins=python --chdir=/var/www/prjt/src/ --socket=127.0.0.1:8889 --module=prjt.wsgi:application & 

tell me that

 probably another instance of uWSGI is running on the same address (127.0.0.1:8889). bind(): Address already in use [core/socket.c line 761] 

I looked for similar problems and found some solutions to destroy all instances of uwsgi mentioned in this answer here

but could not find how to do it.

I am new to this area. Someone can help. I am stuck in this.

Hope the question is clear. thanks in advance

+4
source share
4 answers

Add pidfile to your command:

 uwsgi --plugins=python --chdir=/var/www/prjt/src/ --socket=127.0.0.1:8889 --module=prjt.wsgi:application --pidfile /tmp/myapp.pid 

Then use

 uwsgi --stop /tmp/myapp.pid 

to stop the uwsgi instance in a safe way.

If you did not specify a pidfile when starting the first instance, you can kill it brutally using

 kill `pidof uwsgi` 
+6
source

for me a way to kill instances of uwsgi using brute force:

 sudo pkill -f uwsgi -9 
+3
source

you can get the pid of the uwsgi process here lsof -t -i tcp:8000

and kill him, then kill -9 pid

+2
source

I stop my uwsgi instance with the command:

 kill -INT `cat ${APP_ROOT}/run/uwsgi.pid` 

This command sends a signal to uwsgi , which is why it stops.

If you do not know the PID, than you can:

 killall -s INT /ve/path/bin/uwsgi 

Official documentation

+1
source

All Articles