managing uWSGI with Upstart
Asked Answered
D

1

7

I am trying to configure uWSGI with Upstart.

I created the file /etc/init/uwsgi-flask.conf:

description "uwsgi for flask"
start on runlevel [2345]
stop on runlevel [06]
exec /appdir/virtualenvdir/bin/uwsgi /appdir/virtualenvdir/uwsgi.ini --die-on-term

On reboot, it starts up correctly, but I am not able to stop the service.

If I type on shell initctl stop uwsgi-flask, it gives:

initctl: Unknown instance:

anyone has any idea?

Depoliti answered 16/7, 2013 at 2:54 Comment(4)
A standard command to stop a job is sudo stop service-name. If you are not executing initctl as root then it is logical that instance is unknown since on startup (reboot) process will not be available in user space since it would be started by root as system job. However I assume that you are stopping the job as root. Could you post relevant content of /var/log/upstart/uwsgi-flack.log? It sounds that your job is either not starting at all or exiting after start. You can find some useful information here.Lugworm
@schkovich I am actually trying to stop the service as the user which is running uwsgi, which is a non-root. I have tried sudo stop uwsgi-flask instead, but it gives something similar stop: Unknown instance: . The log says that the uwsgi server is running, but I can't stop it with the commands I typed.Depoliti
Daniele, I've exactly the same problem. Did you find any solution?Monitor
@MichelMüller, eventually I decided to drop Python and write my webservices using Go. I think I had managed to solve that problem, but I can't remember now.Depoliti
U
8

You probably have daemonize=some/log/file/path in your ini file. That will make the process exit with a "normal" exit code, so Upstart will figure that you wanted the job stopped and terminate the job.

Remove daemonize and upstart will track the process in the foreground.

Undulant answered 5/5, 2014 at 21:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.