[uWSGI] Init script for Debian?

Gilles codecomplete at free.fr
Tue Apr 29 14:22:03 CEST 2014


On Fri, 25 Apr 2014 11:57:44 -0400, Tim Tisdall
<tisdall at gmail.com> wrote:
>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.

Thanks Tim, but still no go: The init script still fails killing
uwsgi: "No process in pidfile '/tmp/uwsgi-2.0.3/uwsgi.pid' found
running; none killed."

Just in case, I touched /tmp/uwsgi-2.0.3/uwsgi.pid, but uwsgi doesn't
write to it.

Here are the INI file and my initd script:

=========== my app.ini
[uwsgi]
workdir = /tmp/uwsgi-2.0.3
ipaddress = 0.0.0.0

http = %(ipaddress):8080
stats = 127.0.0.1:9191
processes = 4
threads = 2
uid=nobody
gid=nogroup

static-index = index.html
static-index = index.htm
check-static = %(workdir)/www
static-skip-ext = .lua

http-modifier1=9 ;cgi plug-in

;cgi = /cgi-bin=%(workdir)/cgi
;cgi = %(workdir)/cgi
cgi = /cgi=%(workdir)/cgi
cgi-allowed-ext = .lua
cgi-helper = .lua=lua
cgi-index = index.lua

;added
daemonize = %(workdir)uwsgi.log
pidfile = %(workdir)uwsgi.pid

=========== # touch /tmp/uwsgi-2.0.3/uwsgi.pid

=========== # /etc/init.d/uwsgi start
Starting uwsgi
[uWSGI] getting INI configuration from /tmp/uwsgi-2.0.3/myapp.ini
[uwsgi-static] added check for /tmp/uwsgi-2.0.3/www

/tmp/uwsgi-2.0.3# /etc/init.d/uwsgi stop
Stopping script uwsgi
No process in pidfile '/tmp/uwsgi-2.0.3/uwsgi.pid' found running; none
killed.

=========== /etc/init.d/uwsgi
/tmp/uwsgi-2.0.3# cat /etc/init.d/uwsgi
#! /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=/tmp/uwsgi-2.0.3/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
===========



More information about the uWSGI mailing list