[uWSGI] Init script for Debian?

Tim Tisdall tisdall at gmail.com
Fri Apr 25 17:57:44 CEST 2014


Can you post the content of your "/tmp/uwsgi-2.0.3/myapp.ini" file?  You
need to make sure you have a "daemonize" option in there as well as the
"pidfile" pointing to the same thing as listed in your init script.
Example:

daemonize = /var/log/uwsgi.log
pidfile = /var/run/uwsgi.pid

BTW, I have two .ini files because there's contents in the "--ini" file
that gets choked on by my application.  So the "--ini" file has my uwsgi
settings and my "--ini-paste" has everything else.  So, I don't know what
your set up is, but normally I'd just have a single ini passed in via
"--ini-paste" that contained the uwsgi settings and the settings needed by
my application.


On Thu, Apr 24, 2014 at 7:55 AM, Gilles <codecomplete at free.fr> wrote:

> On Wed, 23 Apr 2014 11:05:49 -0400, Tim Tisdall
> <tisdall at gmail.com> wrote:
> >Here's what I use on debian (not upstart.  it's an executable in
> >/etc/init.d/):
>
> Thanks Tim.
>
> I used the following...
> ==================
> #! /bin/bash
> ### BEGIN INIT INFO
> # Provides:          uwsgi
> # Required-Start:    $local_fs $networking
> # Required-Stop:     $local_fs $networking
> # Default-Start:     2 3 4 5
> # Default-Stop:      0 1 6
> # Short-Description: Starts uwsgi
> # Description:       Starts and stops uwsgi
> ### END INIT INFO
> # /etc/init.d/uwsgi
> #
>
> daemon=/tmp/uwsgi-2.0.3/uwsgi
> pid=/var/run/uwsgi.pid
> args="--ini /tmp/uwsgi-2.0.3/myapp.ini"
>
> # Carry out specific functions when asked to by the system
> case "$1" in
>     start)
>         echo "Starting uwsgi"
>         start-stop-daemon -p $pid --start --exec $daemon -- $args
>         ;;
>     stop)
>         echo "Stopping script uwsgi"
>         start-stop-daemon --signal QUIT -p $pid --stop $daemon --
> $args
>         ;;
>     reload | restart)
>         echo "Restarting worker threads"
>         kill -HUP $(cat $pid)
>         ;;
>     *)
>         echo "Usage: /etc/init.d/uwsgi {start|stop|reload}"
>         exit 1
>     ;;
> esac
>
> exit 0
> ==================
>
>
> ... but when typing "/etc/init.d/uwsgi start", I have to hit CTRL+C to
> go back to the shell prompt:
> ==================
> # /etc/init.d/uwsgi start
> Starting uwsgi
> ...
> spawned uWSGI worker 2 (pid: 19387, cores: 2)
> spawned uWSGI worker 3 (pid: 19388, cores: 2)
> spawned uWSGI worker 4 (pid: 19389, cores: 2)
> *** Stats server enabled on 127.0.0.1:9191 fd: 18 ***
> spawned uWSGI http 1 (pid: 19394)
>
> ^CSIGINT/SIGQUIT received...killing workers...
> gateway "uWSGI http 1" has been buried (pid: 19394)
> worker 1 buried after 0 seconds
> worker 2 buried after 0 seconds
> worker 3 buried after 0 seconds
> worker 4 buried after 0 seconds
> goodbye to uWSGI.
> #
> ==================
>
> Why doesn't the script run in the background?
>
> _______________________________________________
> uWSGI mailing list
> uWSGI at lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20140425/47785de7/attachment.html>


More information about the uWSGI mailing list